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

Unified Diff: content/renderer/skia_benchmarking/skia_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
Index: content/renderer/skia_benchmarking/skia_benchmarking_canvas.h
diff --git a/content/renderer/skia_benchmarking/skia_benchmarking_canvas.h b/content/renderer/skia_benchmarking/skia_benchmarking_canvas.h
new file mode 100644
index 0000000000000000000000000000000000000000..02fa9a8d625379425b069b92305311511e44d172
--- /dev/null
+++ b/content/renderer/skia_benchmarking/skia_benchmarking_canvas.h
@@ -0,0 +1,54 @@
+// 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 CONTENT_RENDERER_SKIA_BENCHMARKING_CANVAS_H_
+#define CONTENT_RENDERER_SKIA_BENCHMARKING_CANVAS_H_
+
+#include "base/compiler_specific.h"
+#include "base/memory/ref_counted.h"
+#include "third_party/skia/include/utils/SkNWayCanvas.h"
+#include "third_party/skia/src/utils/debugger/SkDebugCanvas.h"
+
+namespace gfx {
+class Rect;
+}
+
+namespace content {
+
+class SkiaTimingCanvas;
+
+class SkiaBenchmarkingCanvas : public SkNWayCanvas {
+public:
+ SkiaBenchmarkingCanvas(const gfx::Rect&);
+ virtual ~SkiaBenchmarkingCanvas();
+
+ // 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 (microseconds) for a draw command index.
+ int64 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.
+
+ scoped_refptr<SkDebugCanvas> debug_canvas_;
+ scoped_refptr<SkiaTimingCanvas> timing_canvas_;
+};
+
+}
+#endif // CONTENT_RENDERER_SKIA_BENCHMARKING_CANVAS_H

Powered by Google App Engine
This is Rietveld 408576698