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

Side by Side Diff: third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.cpp

Issue 1738073002: DevTools: introduce protocol::Value, baseline for hierarchical data in remote debugging protocol. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2012 Apple Inc. All rights reserved.
3 * Copyright (C) 2013 Google Inc. All rights reserved. 3 * Copyright (C) 2013 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #include "core/layout/compositing/CompositedLayerMapping.h" 45 #include "core/layout/compositing/CompositedLayerMapping.h"
46 #include "core/layout/compositing/PaintLayerCompositor.h" 46 #include "core/layout/compositing/PaintLayerCompositor.h"
47 #include "core/loader/DocumentLoader.h" 47 #include "core/loader/DocumentLoader.h"
48 #include "core/page/ChromeClient.h" 48 #include "core/page/ChromeClient.h"
49 #include "platform/geometry/IntRect.h" 49 #include "platform/geometry/IntRect.h"
50 #include "platform/graphics/CompositingReasons.h" 50 #include "platform/graphics/CompositingReasons.h"
51 #include "platform/graphics/GraphicsLayer.h" 51 #include "platform/graphics/GraphicsLayer.h"
52 #include "platform/graphics/PictureSnapshot.h" 52 #include "platform/graphics/PictureSnapshot.h"
53 #include "platform/graphics/paint/SkPictureBuilder.h" 53 #include "platform/graphics/paint/SkPictureBuilder.h"
54 #include "platform/image-encoders/skia/PNGImageEncoder.h" 54 #include "platform/image-encoders/skia/PNGImageEncoder.h"
55 #include "platform/inspector_protocol/Parser.h"
55 #include "platform/transforms/TransformationMatrix.h" 56 #include "platform/transforms/TransformationMatrix.h"
56 #include "public/platform/WebFloatPoint.h" 57 #include "public/platform/WebFloatPoint.h"
57 #include "public/platform/WebLayer.h" 58 #include "public/platform/WebLayer.h"
58 #include "wtf/text/Base64.h" 59 #include "wtf/text/Base64.h"
59 #include "wtf/text/StringBuilder.h" 60 #include "wtf/text/StringBuilder.h"
60 61
61 namespace blink { 62 namespace blink {
62 63
63 using protocol::Array; 64 using protocol::Array;
64 unsigned InspectorLayerTreeAgent::s_lastSnapshotId; 65 unsigned InspectorLayerTreeAgent::s_lastSnapshotId;
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 *outTimings = Array<Array<double>>::create(); 428 *outTimings = Array<Array<double>>::create();
428 for (size_t i = 0; i < timings->size(); ++i) { 429 for (size_t i = 0; i < timings->size(); ++i) {
429 const Vector<double>& row = (*timings)[i]; 430 const Vector<double>& row = (*timings)[i];
430 OwnPtr<Array<double>> outRow = Array<double>::create(); 431 OwnPtr<Array<double>> outRow = Array<double>::create();
431 for (size_t j = 0; j < row.size(); ++j) 432 for (size_t j = 0; j < row.size(); ++j)
432 outRow->addItem(row[j]); 433 outRow->addItem(row[j]);
433 (*outTimings)->addItem(outRow.release()); 434 (*outTimings)->addItem(outRow.release());
434 } 435 }
435 } 436 }
436 437
437 void InspectorLayerTreeAgent::snapshotCommandLog(ErrorString* errorString, const String& snapshotId, OwnPtr<Array<RefPtr<JSONObject>>>* commandLog) 438 void InspectorLayerTreeAgent::snapshotCommandLog(ErrorString* errorString, const String& snapshotId, OwnPtr<Array<RefPtr<protocol::DictionaryValue>>>* commandLo g)
438 { 439 {
439 const PictureSnapshot* snapshot = snapshotById(errorString, snapshotId); 440 const PictureSnapshot* snapshot = snapshotById(errorString, snapshotId);
440 if (!snapshot) 441 if (!snapshot)
441 return; 442 return;
442 protocol::ErrorSupport errors(errorString); 443 protocol::ErrorSupport errors(errorString);
443 *commandLog = Array<RefPtr<JSONObject>>::parse(snapshot->snapshotCommandLog( ), &errors); 444 RefPtr<protocol::Value> logValue = protocol::parseJSON(snapshot->snapshotCom mandLog()->toJSONString());
445 *commandLog = Array<RefPtr<protocol::DictionaryValue>>::parse(logValue, &err ors);
444 } 446 }
445 447
446 void InspectorLayerTreeAgent::willAddPageOverlay(const GraphicsLayer* layer) 448 void InspectorLayerTreeAgent::willAddPageOverlay(const GraphicsLayer* layer)
447 { 449 {
448 m_pageOverlayLayerIds.append(layer->platformLayer()->id()); 450 m_pageOverlayLayerIds.append(layer->platformLayer()->id());
449 } 451 }
450 452
451 void InspectorLayerTreeAgent::didRemovePageOverlay(const GraphicsLayer* layer) 453 void InspectorLayerTreeAgent::didRemovePageOverlay(const GraphicsLayer* layer)
452 { 454 {
453 size_t index = m_pageOverlayLayerIds.find(layer->platformLayer()->id()); 455 size_t index = m_pageOverlayLayerIds.find(layer->platformLayer()->id());
454 if (index == WTF::kNotFound) 456 if (index == WTF::kNotFound)
455 return; 457 return;
456 m_pageOverlayLayerIds.remove(index); 458 m_pageOverlayLayerIds.remove(index);
457 } 459 }
458 460
459 461
460 } // namespace blink 462 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698