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

Unified Diff: Source/platform/graphics/GraphicsContextRecorder.cpp

Issue 320423004: DevTools: Clean up snapshot command log. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add test. Created 6 years, 6 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 | « LayoutTests/inspector/layers/layer-canvas-log-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/graphics/GraphicsContextRecorder.cpp
diff --git a/Source/platform/graphics/GraphicsContextRecorder.cpp b/Source/platform/graphics/GraphicsContextRecorder.cpp
index e22ae878e73537d03ebf5f540ce259ffa3311c52..52e04770e0f0394fe3e5877493a892f58c89abb5 100644
--- a/Source/platform/graphics/GraphicsContextRecorder.cpp
+++ b/Source/platform/graphics/GraphicsContextRecorder.cpp
@@ -164,22 +164,9 @@ private:
Vector<double>* m_currentTimings;
};
-class LoggingSnapshotPlayer : public SnapshotPlayer {
-public:
- LoggingSnapshotPlayer(PassRefPtr<SkPicture> picture, SkCanvas* canvas)
- : SnapshotPlayer(picture, canvas)
- {
- }
-
- virtual bool abortDrawing() OVERRIDE
- {
- return false;
- }
-};
-
class LoggingCanvas : public SkCanvas {
public:
- LoggingCanvas()
+ LoggingCanvas(int width, int height) : SkCanvas(width, height)
{
m_log = JSONArray::create();
}
@@ -428,7 +415,8 @@ public:
SaveLayerStrategy willSaveLayer(const SkRect* bounds, const SkPaint* paint, SaveFlags flags) OVERRIDE
{
RefPtr<JSONObject> params = addItemWithParams("saveLayer");
- params->setObject("bounds", objectForSkRect(*bounds));
+ if (bounds)
+ params->setObject("bounds", objectForSkRect(*bounds));
params->setObject("paint", objectForSkPaint(*paint));
params->setString("saveFlags", saveFlagsToString(flags));
this->SkCanvas::willSaveLayer(bounds, paint, flags);
@@ -1035,7 +1023,7 @@ PassOwnPtr<ImageBuffer> GraphicsContextSnapshot::createImageBuffer() const
PassRefPtr<JSONArray> GraphicsContextSnapshot::snapshotCommandLog() const
{
- LoggingCanvas canvas;
+ LoggingCanvas canvas(m_picture->width(), m_picture->height());
FragmentSnapshotPlayer player(m_picture, &canvas);
player.play(0, 0);
return canvas.log();
« no previous file with comments | « LayoutTests/inspector/layers/layer-canvas-log-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698