Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(533)

Unified Diff: skia/ext/benchmarking_canvas.h

Issue 19266015: [SkiaBenchmarkingExtension] Add draw command timing info. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/skia_benchmarking_extension.cc ('k') | skia/ext/benchmarking_canvas.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/benchmarking_canvas.h
diff --git a/skia/ext/benchmarking_canvas.h b/skia/ext/benchmarking_canvas.h
new file mode 100644
index 0000000000000000000000000000000000000000..7ef82049b2c401c077be80078fb9def5c99a4ece
--- /dev/null
+++ b/skia/ext/benchmarking_canvas.h
@@ -0,0 +1,50 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SKIA_EXT_BENCHMARKING_CANVAS_H_
+#define SKIA_EXT_BENCHMARKING_CANVAS_H_
+
+#include "base/compiler_specific.h"
+#include "skia/ext/refptr.h"
+#include "third_party/skia/include/utils/SkNWayCanvas.h"
+#include "third_party/skia/src/utils/debugger/SkDebugCanvas.h"
+
+namespace skia {
+
+class TimingCanvas;
+
+class SK_API BenchmarkingCanvas : public SkNWayCanvas {
+public:
+ BenchmarkingCanvas(int width, int height);
+ virtual ~BenchmarkingCanvas();
+
+ // Returns the number of draw commands executed on this canvas.
+ size_t CommandCount() const;
+
+ // Get draw command info for a given index.
+ SkDrawCommand* GetCommand(size_t index);
+
+ // Return the recorded render time (milliseconds) for a draw command index.
+ double GetTime(size_t index);
+
+private:
+ // In order to avoid introducing a Skia version dependency, this
+ // implementation dispatches draw commands in lock-step to two distinct
+ // canvases:
+ // * a SkDebugCanvas used for gathering command info and tracking
+ // the current command index
+ // * a SkiaTimingCanvas used for measuring raster paint times (and relying
+ // on the former for tracking the current command index).
+ //
+ // This way, if the SkCanvas API is extended, we don't need to worry about
+ // updating content::SkiaTimingCanvas to accurately override all new methods
+ // (to avoid timing info indices from getting out of sync), as SkDebugCanvas
+ // already does that for us.
+
+ skia::RefPtr<SkDebugCanvas> debug_canvas_;
+ skia::RefPtr<TimingCanvas> timing_canvas_;
+};
+
+}
+#endif // SKIA_EXT_BENCHMARKING_CANVAS_H
« no previous file with comments | « content/renderer/skia_benchmarking_extension.cc ('k') | skia/ext/benchmarking_canvas.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698