| OLD | NEW |
| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 .setX(rect.x) | 73 .setX(rect.x) |
| 74 .setY(rect.y) | 74 .setY(rect.y) |
| 75 .setHeight(rect.height) | 75 .setHeight(rect.height) |
| 76 .setWidth(rect.width); | 76 .setWidth(rect.width); |
| 77 RefPtr<TypeBuilder::LayerTree::ScrollRect> scrollRectObject = TypeBuilder::L
ayerTree::ScrollRect::create() | 77 RefPtr<TypeBuilder::LayerTree::ScrollRect> scrollRectObject = TypeBuilder::L
ayerTree::ScrollRect::create() |
| 78 .setRect(rectObject.release()) | 78 .setRect(rectObject.release()) |
| 79 .setType(type); | 79 .setType(type); |
| 80 return scrollRectObject.release(); | 80 return scrollRectObject.release(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 static PassRefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::ScrollRect> > build
ScrollRectsForLayer(GraphicsLayer* graphicsLayer) | 83 static PassRefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::ScrollRect>> buildS
crollRectsForLayer(GraphicsLayer* graphicsLayer) |
| 84 { | 84 { |
| 85 RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::ScrollRect> > scrollRects
= TypeBuilder::Array<TypeBuilder::LayerTree::ScrollRect>::create(); | 85 RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::ScrollRect>> scrollRects =
TypeBuilder::Array<TypeBuilder::LayerTree::ScrollRect>::create(); |
| 86 blink::WebLayer* webLayer = graphicsLayer->platformLayer(); | 86 blink::WebLayer* webLayer = graphicsLayer->platformLayer(); |
| 87 for (size_t i = 0; i < webLayer->nonFastScrollableRegion().size(); ++i) { | 87 for (size_t i = 0; i < webLayer->nonFastScrollableRegion().size(); ++i) { |
| 88 scrollRects->addItem(buildScrollRect(webLayer->nonFastScrollableRegion()
[i], TypeBuilder::LayerTree::ScrollRect::Type::RepaintsOnScroll)); | 88 scrollRects->addItem(buildScrollRect(webLayer->nonFastScrollableRegion()
[i], TypeBuilder::LayerTree::ScrollRect::Type::RepaintsOnScroll)); |
| 89 } | 89 } |
| 90 for (size_t i = 0; i < webLayer->touchEventHandlerRegion().size(); ++i) { | 90 for (size_t i = 0; i < webLayer->touchEventHandlerRegion().size(); ++i) { |
| 91 scrollRects->addItem(buildScrollRect(webLayer->touchEventHandlerRegion()
[i], TypeBuilder::LayerTree::ScrollRect::Type::TouchEventHandler)); | 91 scrollRects->addItem(buildScrollRect(webLayer->touchEventHandlerRegion()
[i], TypeBuilder::LayerTree::ScrollRect::Type::TouchEventHandler)); |
| 92 } | 92 } |
| 93 if (webLayer->haveWheelEventHandlers()) { | 93 if (webLayer->haveWheelEventHandlers()) { |
| 94 blink::WebRect webRect(webLayer->position().x, webLayer->position().y, w
ebLayer->bounds().width, webLayer->bounds().height); | 94 blink::WebRect webRect(webLayer->position().x, webLayer->position().y, w
ebLayer->bounds().width, webLayer->bounds().height); |
| 95 scrollRects->addItem(buildScrollRect(webRect, TypeBuilder::LayerTree::Sc
rollRect::Type::WheelEventHandler)); | 95 scrollRects->addItem(buildScrollRect(webRect, TypeBuilder::LayerTree::Sc
rollRect::Type::WheelEventHandler)); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 115 if (!parent) | 115 if (!parent) |
| 116 parent = graphicsLayer->replicatedLayer(); | 116 parent = graphicsLayer->replicatedLayer(); |
| 117 if (parent) | 117 if (parent) |
| 118 layerObject->setParentLayerId(idForLayer(parent)); | 118 layerObject->setParentLayerId(idForLayer(parent)); |
| 119 if (!graphicsLayer->contentsAreVisible()) | 119 if (!graphicsLayer->contentsAreVisible()) |
| 120 layerObject->setInvisible(true); | 120 layerObject->setInvisible(true); |
| 121 const TransformationMatrix& transform = graphicsLayer->transform(); | 121 const TransformationMatrix& transform = graphicsLayer->transform(); |
| 122 if (!transform.isIdentity()) { | 122 if (!transform.isIdentity()) { |
| 123 TransformationMatrix::FloatMatrix4 flattenedMatrix; | 123 TransformationMatrix::FloatMatrix4 flattenedMatrix; |
| 124 transform.toColumnMajorFloatArray(flattenedMatrix); | 124 transform.toColumnMajorFloatArray(flattenedMatrix); |
| 125 RefPtr<TypeBuilder::Array<double> > transformArray = TypeBuilder::Array<
double>::create(); | 125 RefPtr<TypeBuilder::Array<double>> transformArray = TypeBuilder::Array<d
ouble>::create(); |
| 126 for (size_t i = 0; i < WTF_ARRAY_LENGTH(flattenedMatrix); ++i) | 126 for (size_t i = 0; i < WTF_ARRAY_LENGTH(flattenedMatrix); ++i) |
| 127 transformArray->addItem(flattenedMatrix[i]); | 127 transformArray->addItem(flattenedMatrix[i]); |
| 128 layerObject->setTransform(transformArray); | 128 layerObject->setTransform(transformArray); |
| 129 const FloatPoint3D& transformOrigin = graphicsLayer->transformOrigin(); | 129 const FloatPoint3D& transformOrigin = graphicsLayer->transformOrigin(); |
| 130 // FIXME: rename these to setTransformOrigin* | 130 // FIXME: rename these to setTransformOrigin* |
| 131 if (webLayer->bounds().width > 0) | 131 if (webLayer->bounds().width > 0) |
| 132 layerObject->setAnchorX(transformOrigin.x() / webLayer->bounds().wid
th); | 132 layerObject->setAnchorX(transformOrigin.x() / webLayer->bounds().wid
th); |
| 133 else | 133 else |
| 134 layerObject->setAnchorX(0.0); | 134 layerObject->setAnchorX(0.0); |
| 135 if (webLayer->bounds().height > 0) | 135 if (webLayer->bounds().height > 0) |
| 136 layerObject->setAnchorY(transformOrigin.y() / webLayer->bounds().hei
ght); | 136 layerObject->setAnchorY(transformOrigin.y() / webLayer->bounds().hei
ght); |
| 137 else | 137 else |
| 138 layerObject->setAnchorY(0.0); | 138 layerObject->setAnchorY(0.0); |
| 139 layerObject->setAnchorZ(transformOrigin.z()); | 139 layerObject->setAnchorZ(transformOrigin.z()); |
| 140 } | 140 } |
| 141 RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::ScrollRect> > scrollRects
= buildScrollRectsForLayer(graphicsLayer); | 141 RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::ScrollRect>> scrollRects =
buildScrollRectsForLayer(graphicsLayer); |
| 142 if (scrollRects) | 142 if (scrollRects) |
| 143 layerObject->setScrollRects(scrollRects.release()); | 143 layerObject->setScrollRects(scrollRects.release()); |
| 144 return layerObject; | 144 return layerObject; |
| 145 } | 145 } |
| 146 | 146 |
| 147 InspectorLayerTreeAgent::InspectorLayerTreeAgent(Page* page) | 147 InspectorLayerTreeAgent::InspectorLayerTreeAgent(Page* page) |
| 148 : InspectorBaseAgent<InspectorLayerTreeAgent>("LayerTree") | 148 : InspectorBaseAgent<InspectorLayerTreeAgent>("LayerTree") |
| 149 , m_frontend(0) | 149 , m_frontend(0) |
| 150 , m_page(page) | 150 , m_page(page) |
| 151 { | 151 { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 return; | 208 return; |
| 209 | 209 |
| 210 RefPtr<TypeBuilder::DOM::Rect> domRect = TypeBuilder::DOM::Rect::create() | 210 RefPtr<TypeBuilder::DOM::Rect> domRect = TypeBuilder::DOM::Rect::create() |
| 211 .setX(rect.x()) | 211 .setX(rect.x()) |
| 212 .setY(rect.y()) | 212 .setY(rect.y()) |
| 213 .setWidth(rect.width()) | 213 .setWidth(rect.width()) |
| 214 .setHeight(rect.height()); | 214 .setHeight(rect.height()); |
| 215 m_frontend->layerPainted(idForLayer(graphicsLayer), domRect.release()); | 215 m_frontend->layerPainted(idForLayer(graphicsLayer), domRect.release()); |
| 216 } | 216 } |
| 217 | 217 |
| 218 PassRefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> > InspectorLayerTre
eAgent::buildLayerTree() | 218 PassRefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer>> InspectorLayerTree
Agent::buildLayerTree() |
| 219 { | 219 { |
| 220 RenderLayerCompositor* compositor = renderLayerCompositor(); | 220 RenderLayerCompositor* compositor = renderLayerCompositor(); |
| 221 if (!compositor || !compositor->inCompositingMode()) | 221 if (!compositor || !compositor->inCompositingMode()) |
| 222 return nullptr; | 222 return nullptr; |
| 223 | 223 |
| 224 LayerIdToNodeIdMap layerIdToNodeIdMap; | 224 LayerIdToNodeIdMap layerIdToNodeIdMap; |
| 225 RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> > layers = TypeBuil
der::Array<TypeBuilder::LayerTree::Layer>::create(); | 225 RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer>> layers = TypeBuild
er::Array<TypeBuilder::LayerTree::Layer>::create(); |
| 226 buildLayerIdToNodeIdMap(compositor->rootRenderLayer(), layerIdToNodeIdMap); | 226 buildLayerIdToNodeIdMap(compositor->rootRenderLayer(), layerIdToNodeIdMap); |
| 227 gatherGraphicsLayers(rootGraphicsLayer(), layerIdToNodeIdMap, layers); | 227 gatherGraphicsLayers(rootGraphicsLayer(), layerIdToNodeIdMap, layers); |
| 228 return layers.release(); | 228 return layers.release(); |
| 229 } | 229 } |
| 230 | 230 |
| 231 void InspectorLayerTreeAgent::buildLayerIdToNodeIdMap(RenderLayer* root, LayerId
ToNodeIdMap& layerIdToNodeIdMap) | 231 void InspectorLayerTreeAgent::buildLayerIdToNodeIdMap(RenderLayer* root, LayerId
ToNodeIdMap& layerIdToNodeIdMap) |
| 232 { | 232 { |
| 233 if (root->hasCompositedLayerMapping()) { | 233 if (root->hasCompositedLayerMapping()) { |
| 234 if (Node* node = root->renderer()->generatingNode()) { | 234 if (Node* node = root->renderer()->generatingNode()) { |
| 235 GraphicsLayer* graphicsLayer = root->compositedLayerMapping()->child
ForSuperlayers(); | 235 GraphicsLayer* graphicsLayer = root->compositedLayerMapping()->child
ForSuperlayers(); |
| 236 layerIdToNodeIdMap.set(graphicsLayer->platformLayer()->id(), idForNo
de(node)); | 236 layerIdToNodeIdMap.set(graphicsLayer->platformLayer()->id(), idForNo
de(node)); |
| 237 } | 237 } |
| 238 } | 238 } |
| 239 for (RenderLayer* child = root->firstChild(); child; child = child->nextSibl
ing()) | 239 for (RenderLayer* child = root->firstChild(); child; child = child->nextSibl
ing()) |
| 240 buildLayerIdToNodeIdMap(child, layerIdToNodeIdMap); | 240 buildLayerIdToNodeIdMap(child, layerIdToNodeIdMap); |
| 241 if (!root->renderer()->isRenderIFrame()) | 241 if (!root->renderer()->isRenderIFrame()) |
| 242 return; | 242 return; |
| 243 FrameView* childFrameView = toFrameView(toRenderPart(root->renderer())->widg
et()); | 243 FrameView* childFrameView = toFrameView(toRenderPart(root->renderer())->widg
et()); |
| 244 if (RenderView* childRenderView = childFrameView->renderView()) { | 244 if (RenderView* childRenderView = childFrameView->renderView()) { |
| 245 if (RenderLayerCompositor* childCompositor = childRenderView->compositor
()) | 245 if (RenderLayerCompositor* childCompositor = childRenderView->compositor
()) |
| 246 buildLayerIdToNodeIdMap(childCompositor->rootRenderLayer(), layerIdT
oNodeIdMap); | 246 buildLayerIdToNodeIdMap(childCompositor->rootRenderLayer(), layerIdT
oNodeIdMap); |
| 247 } | 247 } |
| 248 } | 248 } |
| 249 | 249 |
| 250 void InspectorLayerTreeAgent::gatherGraphicsLayers(GraphicsLayer* root, HashMap<
int, int>& layerIdToNodeIdMap, RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree:
:Layer> >& layers) | 250 void InspectorLayerTreeAgent::gatherGraphicsLayers(GraphicsLayer* root, HashMap<
int, int>& layerIdToNodeIdMap, RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree:
:Layer>>& layers) |
| 251 { | 251 { |
| 252 int layerId = root->platformLayer()->id(); | 252 int layerId = root->platformLayer()->id(); |
| 253 if (m_pageOverlayLayerIds.find(layerId) != WTF::kNotFound) | 253 if (m_pageOverlayLayerIds.find(layerId) != WTF::kNotFound) |
| 254 return; | 254 return; |
| 255 layers->addItem(buildObjectForLayer(root, layerIdToNodeIdMap.get(layerId))); | 255 layers->addItem(buildObjectForLayer(root, layerIdToNodeIdMap.get(layerId))); |
| 256 if (GraphicsLayer* replica = root->replicaLayer()) | 256 if (GraphicsLayer* replica = root->replicaLayer()) |
| 257 gatherGraphicsLayers(replica, layerIdToNodeIdMap, layers); | 257 gatherGraphicsLayers(replica, layerIdToNodeIdMap, layers); |
| 258 for (size_t i = 0, size = root->children().size(); i < size; ++i) | 258 for (size_t i = 0, size = root->children().size(); i < size; ++i) |
| 259 gatherGraphicsLayers(root->children()[i], layerIdToNodeIdMap, layers); | 259 gatherGraphicsLayers(root->children()[i], layerIdToNodeIdMap, layers); |
| 260 } | 260 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 *errorString = "Not in compositing mode"; | 307 *errorString = "Not in compositing mode"; |
| 308 return nullptr; | 308 return nullptr; |
| 309 } | 309 } |
| 310 | 310 |
| 311 GraphicsLayer* result = findLayerById(rootGraphicsLayer(), id); | 311 GraphicsLayer* result = findLayerById(rootGraphicsLayer(), id); |
| 312 if (!result) | 312 if (!result) |
| 313 *errorString = "No layer matching given id found"; | 313 *errorString = "No layer matching given id found"; |
| 314 return result; | 314 return result; |
| 315 } | 315 } |
| 316 | 316 |
| 317 void InspectorLayerTreeAgent::compositingReasons(ErrorString* errorString, const
String& layerId, RefPtr<TypeBuilder::Array<String> >& reasonStrings) | 317 void InspectorLayerTreeAgent::compositingReasons(ErrorString* errorString, const
String& layerId, RefPtr<TypeBuilder::Array<String>>& reasonStrings) |
| 318 { | 318 { |
| 319 const GraphicsLayer* graphicsLayer = layerById(errorString, layerId); | 319 const GraphicsLayer* graphicsLayer = layerById(errorString, layerId); |
| 320 if (!graphicsLayer) | 320 if (!graphicsLayer) |
| 321 return; | 321 return; |
| 322 CompositingReasons reasonsBitmask = graphicsLayer->compositingReasons(); | 322 CompositingReasons reasonsBitmask = graphicsLayer->compositingReasons(); |
| 323 reasonStrings = TypeBuilder::Array<String>::create(); | 323 reasonStrings = TypeBuilder::Array<String>::create(); |
| 324 for (size_t i = 0; i < kNumberOfCompositingReasons; ++i) { | 324 for (size_t i = 0; i < kNumberOfCompositingReasons; ++i) { |
| 325 if (!(reasonsBitmask & kCompositingReasonStringMap[i].reason)) | 325 if (!(reasonsBitmask & kCompositingReasonStringMap[i].reason)) |
| 326 continue; | 326 continue; |
| 327 reasonStrings->addItem(kCompositingReasonStringMap[i].shortName); | 327 reasonStrings->addItem(kCompositingReasonStringMap[i].shortName); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 bool newEntry = m_snapshotById.add(*snapshotId, snapshot).isNewEntry; | 363 bool newEntry = m_snapshotById.add(*snapshotId, snapshot).isNewEntry; |
| 364 ASSERT_UNUSED(newEntry, newEntry); | 364 ASSERT_UNUSED(newEntry, newEntry); |
| 365 } | 365 } |
| 366 | 366 |
| 367 void InspectorLayerTreeAgent::loadSnapshot(ErrorString* errorString, const RefPt
r<JSONArray>& tiles, String* snapshotId) | 367 void InspectorLayerTreeAgent::loadSnapshot(ErrorString* errorString, const RefPt
r<JSONArray>& tiles, String* snapshotId) |
| 368 { | 368 { |
| 369 if (!tiles->length()) { | 369 if (!tiles->length()) { |
| 370 *errorString = "Invalid argument, no tiles provided"; | 370 *errorString = "Invalid argument, no tiles provided"; |
| 371 return; | 371 return; |
| 372 } | 372 } |
| 373 Vector<RefPtr<PictureSnapshot::TilePictureStream> > decodedTiles; | 373 Vector<RefPtr<PictureSnapshot::TilePictureStream>> decodedTiles; |
| 374 decodedTiles.grow(tiles->length()); | 374 decodedTiles.grow(tiles->length()); |
| 375 for (size_t i = 0; i < tiles->length(); ++i) { | 375 for (size_t i = 0; i < tiles->length(); ++i) { |
| 376 RefPtr<JSONObject> item; | 376 RefPtr<JSONObject> item; |
| 377 if (!tiles->get(i)->asObject(&item)) { | 377 if (!tiles->get(i)->asObject(&item)) { |
| 378 *errorString = "Invalid argument, array item is not an object"; | 378 *errorString = "Invalid argument, array item is not an object"; |
| 379 return; | 379 return; |
| 380 } | 380 } |
| 381 double x = 0, y = 0; | 381 double x = 0, y = 0; |
| 382 String picture; | 382 String picture; |
| 383 if (!item->getNumber("x", &x) || !item->getNumber("y", &y) | 383 if (!item->getNumber("x", &x) || !item->getNumber("y", &y) |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 return nullptr; | 420 return nullptr; |
| 421 } | 421 } |
| 422 return it->value.get(); | 422 return it->value.get(); |
| 423 } | 423 } |
| 424 | 424 |
| 425 void InspectorLayerTreeAgent::replaySnapshot(ErrorString* errorString, const Str
ing& snapshotId, const int* fromStep, const int* toStep, const double* scale, St
ring* dataURL) | 425 void InspectorLayerTreeAgent::replaySnapshot(ErrorString* errorString, const Str
ing& snapshotId, const int* fromStep, const int* toStep, const double* scale, St
ring* dataURL) |
| 426 { | 426 { |
| 427 const PictureSnapshot* snapshot = snapshotById(errorString, snapshotId); | 427 const PictureSnapshot* snapshot = snapshotById(errorString, snapshotId); |
| 428 if (!snapshot) | 428 if (!snapshot) |
| 429 return; | 429 return; |
| 430 OwnPtr<Vector<char> > base64Data = snapshot->replay(fromStep ? *fromStep : 0
, toStep ? *toStep : 0, scale ? *scale : 1.0); | 430 OwnPtr<Vector<char>> base64Data = snapshot->replay(fromStep ? *fromStep : 0,
toStep ? *toStep : 0, scale ? *scale : 1.0); |
| 431 if (!base64Data) { | 431 if (!base64Data) { |
| 432 *errorString = "Image encoding failed"; | 432 *errorString = "Image encoding failed"; |
| 433 return; | 433 return; |
| 434 } | 434 } |
| 435 StringBuilder url; | 435 StringBuilder url; |
| 436 url.appendLiteral("data:image/png;base64,"); | 436 url.appendLiteral("data:image/png;base64,"); |
| 437 url.reserveCapacity(url.length() + base64Data->size()); | 437 url.reserveCapacity(url.length() + base64Data->size()); |
| 438 url.append(base64Data->begin(), base64Data->size()); | 438 url.append(base64Data->begin(), base64Data->size()); |
| 439 *dataURL = url.toString(); | 439 *dataURL = url.toString(); |
| 440 } | 440 } |
| 441 | 441 |
| 442 static bool parseRect(const JSONObject& object, FloatRect* rect) | 442 static bool parseRect(const JSONObject& object, FloatRect* rect) |
| 443 { | 443 { |
| 444 double x = 0, y = 0; | 444 double x = 0, y = 0; |
| 445 double width = 0, height = 0; | 445 double width = 0, height = 0; |
| 446 if (!object.getNumber("x", &x) || !object.getNumber("y", &y) || !object.getN
umber("width", &width) || !object.getNumber("width", &height)) | 446 if (!object.getNumber("x", &x) || !object.getNumber("y", &y) || !object.getN
umber("width", &width) || !object.getNumber("width", &height)) |
| 447 return false; | 447 return false; |
| 448 *rect = FloatRect(x, y, width, height); | 448 *rect = FloatRect(x, y, width, height); |
| 449 return true; | 449 return true; |
| 450 } | 450 } |
| 451 | 451 |
| 452 void InspectorLayerTreeAgent::profileSnapshot(ErrorString* errorString, const St
ring& snapshotId, const int* minRepeatCount, const double* minDuration, const Re
fPtr<JSONObject>* clipRect, RefPtr<TypeBuilder::Array<TypeBuilder::Array<double>
> >& outTimings) | 452 void InspectorLayerTreeAgent::profileSnapshot(ErrorString* errorString, const St
ring& snapshotId, const int* minRepeatCount, const double* minDuration, const Re
fPtr<JSONObject>* clipRect, RefPtr<TypeBuilder::Array<TypeBuilder::Array<double>
>>& outTimings) |
| 453 { | 453 { |
| 454 const PictureSnapshot* snapshot = snapshotById(errorString, snapshotId); | 454 const PictureSnapshot* snapshot = snapshotById(errorString, snapshotId); |
| 455 if (!snapshot) | 455 if (!snapshot) |
| 456 return; | 456 return; |
| 457 FloatRect rect; | 457 FloatRect rect; |
| 458 if (clipRect && !parseRect(**clipRect, &rect)) { | 458 if (clipRect && !parseRect(**clipRect, &rect)) { |
| 459 *errorString = "Invalid argument, missing required field"; | 459 *errorString = "Invalid argument, missing required field"; |
| 460 return; | 460 return; |
| 461 } | 461 } |
| 462 OwnPtr<PictureSnapshot::Timings> timings = snapshot->profile(minRepeatCount
? *minRepeatCount : 1, minDuration ? *minDuration : 0, clipRect ? &rect : 0); | 462 OwnPtr<PictureSnapshot::Timings> timings = snapshot->profile(minRepeatCount
? *minRepeatCount : 1, minDuration ? *minDuration : 0, clipRect ? &rect : 0); |
| 463 outTimings = TypeBuilder::Array<TypeBuilder::Array<double> >::create(); | 463 outTimings = TypeBuilder::Array<TypeBuilder::Array<double>>::create(); |
| 464 for (size_t i = 0; i < timings->size(); ++i) { | 464 for (size_t i = 0; i < timings->size(); ++i) { |
| 465 const Vector<double>& row = (*timings)[i]; | 465 const Vector<double>& row = (*timings)[i]; |
| 466 RefPtr<TypeBuilder::Array<double> > outRow = TypeBuilder::Array<double>:
:create(); | 466 RefPtr<TypeBuilder::Array<double>> outRow = TypeBuilder::Array<double>::
create(); |
| 467 for (size_t j = 0; j < row.size(); ++j) | 467 for (size_t j = 0; j < row.size(); ++j) |
| 468 outRow->addItem(row[j]); | 468 outRow->addItem(row[j]); |
| 469 outTimings->addItem(outRow.release()); | 469 outTimings->addItem(outRow.release()); |
| 470 } | 470 } |
| 471 } | 471 } |
| 472 | 472 |
| 473 void InspectorLayerTreeAgent::snapshotCommandLog(ErrorString* errorString, const
String& snapshotId, RefPtr<TypeBuilder::Array<JSONObject> >& commandLog) | 473 void InspectorLayerTreeAgent::snapshotCommandLog(ErrorString* errorString, const
String& snapshotId, RefPtr<TypeBuilder::Array<JSONObject>>& commandLog) |
| 474 { | 474 { |
| 475 const PictureSnapshot* snapshot = snapshotById(errorString, snapshotId); | 475 const PictureSnapshot* snapshot = snapshotById(errorString, snapshotId); |
| 476 if (!snapshot) | 476 if (!snapshot) |
| 477 return; | 477 return; |
| 478 commandLog = TypeBuilder::Array<JSONObject>::runtimeCast(snapshot->snapshotC
ommandLog()); | 478 commandLog = TypeBuilder::Array<JSONObject>::runtimeCast(snapshot->snapshotC
ommandLog()); |
| 479 } | 479 } |
| 480 | 480 |
| 481 void InspectorLayerTreeAgent::willAddPageOverlay(const GraphicsLayer* layer) | 481 void InspectorLayerTreeAgent::willAddPageOverlay(const GraphicsLayer* layer) |
| 482 { | 482 { |
| 483 m_pageOverlayLayerIds.append(layer->platformLayer()->id()); | 483 m_pageOverlayLayerIds.append(layer->platformLayer()->id()); |
| 484 } | 484 } |
| 485 | 485 |
| 486 void InspectorLayerTreeAgent::didRemovePageOverlay(const GraphicsLayer* layer) | 486 void InspectorLayerTreeAgent::didRemovePageOverlay(const GraphicsLayer* layer) |
| 487 { | 487 { |
| 488 size_t index = m_pageOverlayLayerIds.find(layer->platformLayer()->id()); | 488 size_t index = m_pageOverlayLayerIds.find(layer->platformLayer()->id()); |
| 489 if (index == WTF::kNotFound) | 489 if (index == WTF::kNotFound) |
| 490 return; | 490 return; |
| 491 m_pageOverlayLayerIds.remove(index); | 491 m_pageOverlayLayerIds.remove(index); |
| 492 } | 492 } |
| 493 | 493 |
| 494 | 494 |
| 495 } // namespace blink | 495 } // namespace blink |
| OLD | NEW |