| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 *errorString = "Inspected frame has gone"; | 261 *errorString = "Inspected frame has gone"; |
| 262 return InjectedScriptCanvasModule(); | 262 return InjectedScriptCanvasModule(); |
| 263 } | 263 } |
| 264 return injectedScriptCanvasModule(errorString, injectedScript.scriptState())
; | 264 return injectedScriptCanvasModule(errorString, injectedScript.scriptState())
; |
| 265 } | 265 } |
| 266 | 266 |
| 267 void InspectorCanvasAgent::findFramesWithUninstrumentedCanvases() | 267 void InspectorCanvasAgent::findFramesWithUninstrumentedCanvases() |
| 268 { | 268 { |
| 269 class NodeVisitor final : public WrappedNodeVisitor { | 269 class NodeVisitor final : public WrappedNodeVisitor { |
| 270 public: | 270 public: |
| 271 NodeVisitor(Page* page, FramesWithUninstrumentedCanvases& result) | 271 NodeVisitor(LocalFrame* frame, FramesWithUninstrumentedCanvases& result) |
| 272 : m_page(page) | 272 : m_frame(frame) |
| 273 , m_framesWithUninstrumentedCanvases(result) | 273 , m_framesWithUninstrumentedCanvases(result) |
| 274 { | 274 { |
| 275 } | 275 } |
| 276 | 276 |
| 277 virtual void visitNode(Node* node) override | 277 virtual void visitNode(Node* node) override |
| 278 { | 278 { |
| 279 ASSERT(node); | 279 ASSERT(node); |
| 280 if (!isHTMLCanvasElement(*node) || !node->document().frame()) | 280 if (!isHTMLCanvasElement(*node) || !node->document().frame()) |
| 281 return; | 281 return; |
| 282 | 282 |
| 283 LocalFrame* frame = node->document().frame(); | 283 LocalFrame* frame = node->document().frame(); |
| 284 if (frame->page() != m_page) | 284 if (frame->localFrameRoot() != m_frame) |
| 285 return; | 285 return; |
| 286 | 286 |
| 287 if (toHTMLCanvasElement(node)->renderingContext()) | 287 if (toHTMLCanvasElement(node)->renderingContext()) |
| 288 m_framesWithUninstrumentedCanvases.set(frame, true); | 288 m_framesWithUninstrumentedCanvases.set(frame, true); |
| 289 } | 289 } |
| 290 | 290 |
| 291 private: | 291 private: |
| 292 Page* m_page; | 292 LocalFrame* m_frame; |
| 293 FramesWithUninstrumentedCanvases& m_framesWithUninstrumentedCanvases; | 293 FramesWithUninstrumentedCanvases& m_framesWithUninstrumentedCanvases; |
| 294 } nodeVisitor(m_pageAgent->page(), m_framesWithUninstrumentedCanvases); | 294 } nodeVisitor(m_pageAgent->mainFrame(), m_framesWithUninstrumentedCanvases); |
| 295 | 295 |
| 296 m_framesWithUninstrumentedCanvases.clear(); | 296 m_framesWithUninstrumentedCanvases.clear(); |
| 297 ScriptProfiler::visitNodeWrappers(&nodeVisitor); | 297 ScriptProfiler::visitNodeWrappers(&nodeVisitor); |
| 298 | 298 |
| 299 if (m_frontend) { | 299 if (m_frontend) { |
| 300 for (const auto& frame : m_framesWithUninstrumentedCanvases) { | 300 for (const auto& frame : m_framesWithUninstrumentedCanvases) { |
| 301 String frameId = m_pageAgent->frameId(frame.key); | 301 String frameId = m_pageAgent->frameId(frame.key); |
| 302 if (!frameId.isEmpty()) | 302 if (!frameId.isEmpty()) |
| 303 m_frontend->contextCreated(frameId); | 303 m_frontend->contextCreated(frameId); |
| 304 } | 304 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 ErrorString error; | 351 ErrorString error; |
| 352 for (const auto& frame : m_framesWithUninstrumentedCanvases) { | 352 for (const auto& frame : m_framesWithUninstrumentedCanvases) { |
| 353 InjectedScriptCanvasModule module = injectedScriptCanvasModule(&error, S
criptState::forMainWorld(frame.key)); | 353 InjectedScriptCanvasModule module = injectedScriptCanvasModule(&error, S
criptState::forMainWorld(frame.key)); |
| 354 if (!module.isEmpty()) | 354 if (!module.isEmpty()) |
| 355 module.markFrameEnd(); | 355 module.markFrameEnd(); |
| 356 } | 356 } |
| 357 } | 357 } |
| 358 | 358 |
| 359 } // namespace blink | 359 } // namespace blink |
| 360 | 360 |
| OLD | NEW |