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

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

Issue 319603007: DevTools: Add snapshot command log on the frontend. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Select command log step range on the frontend. 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
Index: Source/platform/graphics/GraphicsContextRecorder.cpp
diff --git a/Source/platform/graphics/GraphicsContextRecorder.cpp b/Source/platform/graphics/GraphicsContextRecorder.cpp
index 02615de435184b81902e47fee8b0ae3087c9a66d..6b7a0f0e9dea0d0c3abe34cc9062685b186280fc 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 {
caseq 2014/06/05 11:14:24 Let's move that into a separate patch.
malch 2014/06/05 12:41:09 Done.
-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();

Powered by Google App Engine
This is Rietveld 408576698