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

Side by Side Diff: Source/core/inspector/PageDebuggerAgent.cpp

Issue 1118963002: Revert of DevTools: remove dependency of most agents on InspectorPageAgent (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/inspector/PageDebuggerAgent.h ('k') | Source/core/inspector/PageRuntimeAgent.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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 20 matching lines...) Expand all
31 #include "config.h" 31 #include "config.h"
32 #include "core/inspector/PageDebuggerAgent.h" 32 #include "core/inspector/PageDebuggerAgent.h"
33 33
34 #include "bindings/core/v8/DOMWrapperWorld.h" 34 #include "bindings/core/v8/DOMWrapperWorld.h"
35 #include "bindings/core/v8/ScriptController.h" 35 #include "bindings/core/v8/ScriptController.h"
36 #include "bindings/core/v8/ScriptSourceCode.h" 36 #include "bindings/core/v8/ScriptSourceCode.h"
37 #include "core/frame/FrameConsole.h" 37 #include "core/frame/FrameConsole.h"
38 #include "core/frame/LocalFrame.h" 38 #include "core/frame/LocalFrame.h"
39 #include "core/inspector/InjectedScript.h" 39 #include "core/inspector/InjectedScript.h"
40 #include "core/inspector/InspectorOverlay.h" 40 #include "core/inspector/InspectorOverlay.h"
41 #include "core/inspector/InspectorPageAgent.h"
41 #include "core/inspector/InstrumentingAgents.h" 42 #include "core/inspector/InstrumentingAgents.h"
42 #include "core/loader/DocumentLoader.h" 43 #include "core/loader/DocumentLoader.h"
43 #include "core/page/Page.h" 44 #include "core/page/Page.h"
44 45
45 namespace blink { 46 namespace blink {
46 47
47 PassOwnPtrWillBeRawPtr<PageDebuggerAgent> PageDebuggerAgent::create(LocalFrame* inspectedFrame, PageScriptDebugServer* pageScriptDebugServer, InjectedScriptMana ger* injectedScriptManager, InspectorOverlay* overlay, int debuggerId) 48 PassOwnPtrWillBeRawPtr<PageDebuggerAgent> PageDebuggerAgent::create(PageScriptDe bugServer* pageScriptDebugServer, InspectorPageAgent* pageAgent, InjectedScriptM anager* injectedScriptManager, InspectorOverlay* overlay, int debuggerId)
48 { 49 {
49 return adoptPtrWillBeNoop(new PageDebuggerAgent(inspectedFrame, pageScriptDe bugServer, injectedScriptManager, overlay, debuggerId)); 50 return adoptPtrWillBeNoop(new PageDebuggerAgent(pageScriptDebugServer, pageA gent, injectedScriptManager, overlay, debuggerId));
50 } 51 }
51 52
52 PageDebuggerAgent::PageDebuggerAgent(LocalFrame* inspectedFrame, PageScriptDebug Server* pageScriptDebugServer, InjectedScriptManager* injectedScriptManager, Ins pectorOverlay* overlay, int debuggerId) 53 PageDebuggerAgent::PageDebuggerAgent(PageScriptDebugServer* pageScriptDebugServe r, InspectorPageAgent* pageAgent, InjectedScriptManager* injectedScriptManager, InspectorOverlay* overlay, int debuggerId)
53 : InspectorDebuggerAgent(injectedScriptManager) 54 : InspectorDebuggerAgent(injectedScriptManager)
54 , m_inspectedFrame(inspectedFrame)
55 , m_pageScriptDebugServer(pageScriptDebugServer) 55 , m_pageScriptDebugServer(pageScriptDebugServer)
56 , m_pageAgent(pageAgent)
56 , m_overlay(overlay) 57 , m_overlay(overlay)
57 , m_debuggerId(debuggerId) 58 , m_debuggerId(debuggerId)
58 { 59 {
59 m_overlay->setListener(this); 60 m_overlay->setListener(this);
60 } 61 }
61 62
62 PageDebuggerAgent::~PageDebuggerAgent() 63 PageDebuggerAgent::~PageDebuggerAgent()
63 { 64 {
64 } 65 }
65 66
66 DEFINE_TRACE(PageDebuggerAgent) 67 DEFINE_TRACE(PageDebuggerAgent)
67 { 68 {
68 visitor->trace(m_inspectedFrame);
69 visitor->trace(m_pageScriptDebugServer); 69 visitor->trace(m_pageScriptDebugServer);
70 visitor->trace(m_pageAgent);
70 visitor->trace(m_overlay); 71 visitor->trace(m_overlay);
71 InspectorDebuggerAgent::trace(visitor); 72 InspectorDebuggerAgent::trace(visitor);
72 } 73 }
73 74
74 void PageDebuggerAgent::enable() 75 void PageDebuggerAgent::enable()
75 { 76 {
76 InspectorDebuggerAgent::enable(); 77 InspectorDebuggerAgent::enable();
77 m_instrumentingAgents->setPageDebuggerAgent(this); 78 m_instrumentingAgents->setPageDebuggerAgent(this);
78 } 79 }
79 80
80 void PageDebuggerAgent::disable() 81 void PageDebuggerAgent::disable()
81 { 82 {
82 InspectorDebuggerAgent::disable(); 83 InspectorDebuggerAgent::disable();
83 m_instrumentingAgents->setPageDebuggerAgent(0); 84 m_instrumentingAgents->setPageDebuggerAgent(0);
84 } 85 }
85 86
86 void PageDebuggerAgent::startListeningScriptDebugServer() 87 void PageDebuggerAgent::startListeningScriptDebugServer()
87 { 88 {
88 scriptDebugServer().addListener(this, m_inspectedFrame, m_debuggerId); 89 scriptDebugServer().addListener(this, m_pageAgent->inspectedFrame(), m_debug gerId);
89 } 90 }
90 91
91 void PageDebuggerAgent::stopListeningScriptDebugServer() 92 void PageDebuggerAgent::stopListeningScriptDebugServer()
92 { 93 {
93 scriptDebugServer().removeListener(this, m_inspectedFrame); 94 scriptDebugServer().removeListener(this, m_pageAgent->inspectedFrame());
94 } 95 }
95 96
96 PageScriptDebugServer& PageDebuggerAgent::scriptDebugServer() 97 PageScriptDebugServer& PageDebuggerAgent::scriptDebugServer()
97 { 98 {
98 return *m_pageScriptDebugServer; 99 return *m_pageScriptDebugServer;
99 } 100 }
100 101
101 void PageDebuggerAgent::muteConsole() 102 void PageDebuggerAgent::muteConsole()
102 { 103 {
103 FrameConsole::mute(); 104 FrameConsole::mute();
(...skipping 12 matching lines...) Expand all
116 117
117 void PageDebuggerAgent::overlaySteppedOver() 118 void PageDebuggerAgent::overlaySteppedOver()
118 { 119 {
119 ErrorString error; 120 ErrorString error;
120 stepOver(&error); 121 stepOver(&error);
121 } 122 }
122 123
123 InjectedScript PageDebuggerAgent::injectedScriptForEval(ErrorString* errorString , const int* executionContextId) 124 InjectedScript PageDebuggerAgent::injectedScriptForEval(ErrorString* errorString , const int* executionContextId)
124 { 125 {
125 if (!executionContextId) { 126 if (!executionContextId) {
126 ScriptState* scriptState = ScriptState::forMainWorld(m_inspectedFrame); 127 ScriptState* scriptState = ScriptState::forMainWorld(m_pageAgent->inspec tedFrame());
127 InjectedScript result = injectedScriptManager()->injectedScriptFor(scrip tState); 128 InjectedScript result = injectedScriptManager()->injectedScriptFor(scrip tState);
128 if (result.isEmpty()) 129 if (result.isEmpty())
129 *errorString = "Internal error: main world execution context not fou nd."; 130 *errorString = "Internal error: main world execution context not fou nd.";
130 return result; 131 return result;
131 } 132 }
132 InjectedScript injectedScript = injectedScriptManager()->injectedScriptForId (*executionContextId); 133 InjectedScript injectedScript = injectedScriptManager()->injectedScriptForId (*executionContextId);
133 if (injectedScript.isEmpty()) 134 if (injectedScript.isEmpty())
134 *errorString = "Execution context with given id not found."; 135 *errorString = "Execution context with given id not found.";
135 return injectedScript; 136 return injectedScript;
136 } 137 }
137 138
138 void PageDebuggerAgent::didStartProvisionalLoad(LocalFrame* frame) 139 void PageDebuggerAgent::didStartProvisionalLoad(LocalFrame* frame)
139 { 140 {
140 if (frame == m_inspectedFrame) { 141 if (frame == m_pageAgent->inspectedFrame()) {
141 ErrorString error; 142 ErrorString error;
142 resume(&error); 143 resume(&error);
143 } 144 }
144 } 145 }
145 146
146 void PageDebuggerAgent::didClearDocumentOfWindowObject(LocalFrame* frame) 147 void PageDebuggerAgent::didClearDocumentOfWindowObject(LocalFrame* frame)
147 { 148 {
148 // FIXME: what about nested objects? 149 // FIXME: what about nested objects?
149 if (frame != m_inspectedFrame) 150 if (frame != m_pageAgent->inspectedFrame())
150 return; 151 return;
151 reset(); 152 reset();
152 } 153 }
153 154
154 void PageDebuggerAgent::didCommitLoadForLocalFrame(LocalFrame*) 155 void PageDebuggerAgent::didCommitLoadForLocalFrame(LocalFrame*)
155 { 156 {
156 resetModifiedSources(); 157 resetModifiedSources();
157 } 158 }
158 159
159 } // namespace blink 160 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/inspector/PageDebuggerAgent.h ('k') | Source/core/inspector/PageRuntimeAgent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698