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

Side by Side Diff: third_party/WebKit/Source/web/InspectorOverlay.cpp

Issue 2796653003: Move ScriptState::forWorld/ScriptState::forMainWorld (Part 2) (Closed)
Patch Set: Rebase Created 3 years, 8 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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 14 matching lines...) Expand all
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29 #include "web/InspectorOverlay.h" 29 #include "web/InspectorOverlay.h"
30 30
31 #include <memory> 31 #include <memory>
32 32
33 #include "bindings/core/v8/ScriptController.h" 33 #include "bindings/core/v8/ScriptController.h"
34 #include "bindings/core/v8/ScriptSourceCode.h" 34 #include "bindings/core/v8/ScriptSourceCode.h"
35 #include "bindings/core/v8/V8Binding.h"
35 #include "bindings/core/v8/V8InspectorOverlayHost.h" 36 #include "bindings/core/v8/V8InspectorOverlayHost.h"
36 #include "core/dom/Node.h" 37 #include "core/dom/Node.h"
37 #include "core/dom/StaticNodeList.h" 38 #include "core/dom/StaticNodeList.h"
38 #include "core/dom/TaskRunnerHelper.h" 39 #include "core/dom/TaskRunnerHelper.h"
39 #include "core/frame/FrameView.h" 40 #include "core/frame/FrameView.h"
40 #include "core/frame/LocalFrame.h" 41 #include "core/frame/LocalFrame.h"
41 #include "core/frame/LocalFrameClient.h" 42 #include "core/frame/LocalFrameClient.h"
42 #include "core/frame/Settings.h" 43 #include "core/frame/Settings.h"
43 #include "core/frame/VisualViewport.h" 44 #include "core/frame/VisualViewport.h"
44 #include "core/html/HTMLFrameOwnerElement.h" 45 #include "core/html/HTMLFrameOwnerElement.h"
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 frame->view()->setCanHaveScrollbars(false); 554 frame->view()->setCanHaveScrollbars(false);
554 frame->view()->setBaseBackgroundColor(Color::transparent); 555 frame->view()->setBaseBackgroundColor(Color::transparent);
555 556
556 const WebData& overlayPageHTMLResource = 557 const WebData& overlayPageHTMLResource =
557 Platform::current()->loadResource("InspectorOverlayPage.html"); 558 Platform::current()->loadResource("InspectorOverlayPage.html");
558 loader.load( 559 loader.load(
559 FrameLoadRequest(0, blankURL(), 560 FrameLoadRequest(0, blankURL(),
560 SubstituteData(overlayPageHTMLResource, "text/html", 561 SubstituteData(overlayPageHTMLResource, "text/html",
561 "UTF-8", KURL(), ForceSynchronousLoad))); 562 "UTF-8", KURL(), ForceSynchronousLoad)));
562 v8::Isolate* isolate = toIsolate(frame); 563 v8::Isolate* isolate = toIsolate(frame);
563 ScriptState* scriptState = ScriptState::forMainWorld(frame); 564 ScriptState* scriptState = toScriptStateForMainWorld(frame);
564 DCHECK(scriptState); 565 DCHECK(scriptState);
565 ScriptState::Scope scope(scriptState); 566 ScriptState::Scope scope(scriptState);
566 v8::Local<v8::Object> global = scriptState->context()->Global(); 567 v8::Local<v8::Object> global = scriptState->context()->Global();
567 v8::Local<v8::Value> overlayHostObj = 568 v8::Local<v8::Value> overlayHostObj =
568 ToV8(m_overlayHost.get(), global, isolate); 569 ToV8(m_overlayHost.get(), global, isolate);
569 DCHECK(!overlayHostObj.IsEmpty()); 570 DCHECK(!overlayHostObj.IsEmpty());
570 global 571 global
571 ->Set(scriptState->context(), 572 ->Set(scriptState->context(),
572 v8AtomicString(isolate, "InspectorOverlayHost"), overlayHostObj) 573 v8AtomicString(isolate, "InspectorOverlayHost"), overlayHostObj)
573 .ToChecked(); 574 .ToChecked();
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 bool InspectorOverlay::shouldSearchForNode() { 803 bool InspectorOverlay::shouldSearchForNode() {
803 return m_inspectMode != InspectorDOMAgent::NotSearching; 804 return m_inspectMode != InspectorDOMAgent::NotSearching;
804 } 805 }
805 806
806 void InspectorOverlay::inspect(Node* node) { 807 void InspectorOverlay::inspect(Node* node) {
807 if (m_domAgent) 808 if (m_domAgent)
808 m_domAgent->inspect(node); 809 m_domAgent->inspect(node);
809 } 810 }
810 811
811 } // namespace blink 812 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698