Create stub GrAuditTrail class

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1572553002

Review URL: https://codereview.chromium.org/1572553002
This commit is contained in:
joshualitt 2016-01-08 07:19:47 -08:00 committed by Commit bot
parent 55c86abedc
commit 27a48dc0cd
4 changed files with 76 additions and 0 deletions

View File

@ -55,8 +55,10 @@
'<(skia_include_path)/gpu/gl/GrGLTypes.h',
# Private includes
'<(skia_include_path)/private/GrAuditTrail.h',
'<(skia_include_path)/private/GrSingleOwner.h',
'<(skia_src_path)/gpu/GrAuditTrail.cpp',
'<(skia_src_path)/gpu/GrAutoLocaleSetter.h',
'<(skia_src_path)/gpu/GrAllocator.h',
'<(skia_src_path)/gpu/GrBatchAtlas.cpp',

View File

@ -17,6 +17,7 @@
#include "SkMatrix.h"
#include "SkPathEffect.h"
#include "SkTypes.h"
#include "../private/GrAuditTrail.h"
#include "../private/GrSingleOwner.h"
#include "../private/SkMutex.h"
@ -358,6 +359,8 @@ public:
/** Get pointer to atlas texture for given mask format */
GrTexture* getFontAtlasTexture(GrMaskFormat format);
SkString dumpAuditTrailToJson() const { return fAuditTrail.toJson(); }
private:
GrGpu* fGpu;
const GrCaps* fCaps;
@ -405,6 +408,8 @@ private:
SkAutoTDelete<GrDrawingManager> fDrawingManager;
GrAuditTrail fAuditTrail;
// TODO: have the CMM use drawContexts and rm this friending
friend class GrClipMaskManager; // the CMM is friended just so it can call 'drawingManager'
friend class GrDrawingManager; // for access to drawingManager for ProgramUnitTest

View File

@ -0,0 +1,37 @@
/*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef GrAuditTrail_DEFINED
#define GrAuditTrail_DEFINED
#include "SkString.h"
#include "SkTArray.h"
/*
* GrAuditTrail collects a list of draw ops, detailed information about those ops, and can dump them
* to json.
*/
class GrAuditTrail {
public:
void addOp(SkString name) {
fOps.push_back().fName = name;
}
SkString toJson() const;
void reset() { fOps.reset(); }
private:
struct Op {
SkString toJson() const;
SkString fName;
};
SkTArray<Op> fOps;
};
#endif

32
src/gpu/GrAuditTrail.cpp Normal file
View File

@ -0,0 +1,32 @@
/*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "GrAuditTrail.h"
SkString GrAuditTrail::toJson() const {
SkString json;
json.append("{\n");
json.append("Ops: [\n");
for (int i = 0; i < fOps.count(); i++) {
json.append(fOps[i].toJson());
if (i < fOps.count() - 1) {
json.append(",\n");
}
}
json.append("]\n");
json.append("}\n");
return json;
}
SkString GrAuditTrail::Op::toJson() const {
SkString json;
json.append("{\n");
json.appendf("%s\n", fName.c_str());
json.append("}\n");
return json;
}