Changeset 82845 in webkit
- Timestamp:
- Apr 4, 2011 10:32:51 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r82843 r82845 1 2011-04-04 Yury Semikhatsky <yurys@chromium.org> 2 3 Reviewed by Pavel Feldman. 4 5 Web Inspector: InspectorRuntimeAgent should not depend on Page 6 https://bugs.webkit.org/show_bug.cgi?id=57759 7 8 Descendants of InspectorRuntimeAgent should implement a method providing access to the default 9 inspected state used for console evaluations. 10 11 * inspector/InspectorAgent.cpp: 12 (WebCore::InspectorAgent::InspectorAgent): runtime agent is created and deleted along with other agents. 13 (WebCore::InspectorAgent::setFrontend): 14 * inspector/InspectorAgent.h: 15 * inspector/InspectorRuntimeAgent.cpp: 16 (WebCore::InspectorRuntimeAgent::create): 17 (WebCore::InspectorRuntimeAgent::InspectorRuntimeAgent): 18 (WebCore::InspectorRuntimeAgent::evaluate): 19 * inspector/InspectorRuntimeAgent.h: 20 (WebCore::InspectorRuntimeAgent::InspectedStateProvider::~InspectedStateProvider): 21 1 22 2011-04-04 Yong Li <yoli@rim.com> 2 23 -
trunk/Source/WebCore/inspector/InspectorAgent.cpp
r82449 r82845 90 90 static const char profilesPanelName[] = "profiles"; 91 91 92 namespace { 93 94 class PageRuntimeAgent : public InspectorRuntimeAgent { 95 public: 96 PageRuntimeAgent(InjectedScriptManager* injectedScriptManager, Page* page) 97 : InspectorRuntimeAgent(injectedScriptManager) 98 , m_inspectedPage(page) { } 99 virtual ~PageRuntimeAgent() { } 100 101 private: 102 virtual ScriptState* getDefaultInspectedState() { return mainWorldScriptState(m_inspectedPage->mainFrame()); } 103 Page* m_inspectedPage; 104 }; 105 106 } 107 92 108 InspectorAgent::InspectorAgent(Page* page, InspectorClient* client, InjectedScriptManager* injectedScriptManager) 93 109 : m_inspectedPage(page) … … 111 127 #endif 112 128 , m_resourceAgent(InspectorResourceAgent::create(m_instrumentingAgents.get(), page, m_state.get())) 129 , m_runtimeAgent(adoptPtr(new PageRuntimeAgent(m_injectedScriptManager, page))) 113 130 , m_consoleAgent(new InspectorConsoleAgent(m_instrumentingAgents.get(), this, m_state.get(), injectedScriptManager, m_domAgent.get())) 114 131 #if ENABLE(JAVASCRIPT_DEBUGGER) … … 163 180 m_inspectedPage = 0; 164 181 165 releaseFrontendLifetimeAgents();166 182 m_injectedScriptManager->disconnect(); 167 183 … … 202 218 203 219 m_frontend = inspectorFrontend; 204 createFrontendLifetimeAgents();205 220 206 221 #if ENABLE(OFFLINE_WEB_APPLICATIONS) … … 273 288 #endif 274 289 m_pageAgent->clearFrontend(); 275 276 releaseFrontendLifetimeAgents();277 }278 279 void InspectorAgent::createFrontendLifetimeAgents()280 {281 m_runtimeAgent = InspectorRuntimeAgent::create(m_injectedScriptManager, m_inspectedPage);282 }283 284 void InspectorAgent::releaseFrontendLifetimeAgents()285 {286 m_runtimeAgent.clear();287 290 } 288 291 -
trunk/Source/WebCore/inspector/InspectorAgent.h
r82403 r82845 178 178 void unbindAllResources(); 179 179 180 void releaseFrontendLifetimeAgents();181 void createFrontendLifetimeAgents();182 183 180 #if ENABLE(JAVASCRIPT_DEBUGGER) 184 181 void toggleRecordButton(bool); -
trunk/Source/WebCore/inspector/InspectorRuntimeAgent.cpp
r82804 r82845 37 37 #include "InjectedScriptManager.h" 38 38 #include "InspectorValues.h" 39 #include "Page.h"40 #include <wtf/PassOwnPtr.h>41 39 #include <wtf/PassRefPtr.h> 42 40 43 41 namespace WebCore { 44 42 45 PassOwnPtr<InspectorRuntimeAgent> InspectorRuntimeAgent::create(InjectedScriptManager* injectedScriptManager, Page* inspectedPage) 46 { 47 return adoptPtr(new InspectorRuntimeAgent(injectedScriptManager, inspectedPage)); 48 } 49 50 InspectorRuntimeAgent::InspectorRuntimeAgent(InjectedScriptManager* injectedScriptManager, Page* inspectedPage) 43 InspectorRuntimeAgent::InspectorRuntimeAgent(InjectedScriptManager* injectedScriptManager) 51 44 : m_injectedScriptManager(injectedScriptManager) 52 , m_inspectedPage(inspectedPage)53 45 { 54 46 } … … 60 52 void InspectorRuntimeAgent::evaluate(ErrorString* errorString, const String& expression, const String& objectGroup, const bool* const optionalIncludeCommandLineAPI, RefPtr<InspectorObject>* result) 61 53 { 62 ScriptState* scriptState = mainWorldScriptState(m_inspectedPage->mainFrame()); 63 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(scriptState); 54 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(getDefaultInspectedState()); 64 55 if (!injectedScript.hasNoValue()) 65 56 injectedScript.evaluate(errorString, expression, objectGroup, optionalIncludeCommandLineAPI ? *optionalIncludeCommandLineAPI : false, result); -
trunk/Source/WebCore/inspector/InspectorRuntimeAgent.h
r82804 r82845 34 34 #if ENABLE(INSPECTOR) 35 35 36 #include "ScriptState.h" 36 37 #include <wtf/Forward.h> 37 38 #include <wtf/Noncopyable.h> … … 43 44 class InspectorObject; 44 45 class InspectorValue; 45 class Page;46 46 47 47 typedef String ErrorString; … … 50 50 WTF_MAKE_NONCOPYABLE(InspectorRuntimeAgent); 51 51 public: 52 static PassOwnPtr<InspectorRuntimeAgent> create(InjectedScriptManager*, Page*); 53 ~InspectorRuntimeAgent(); 52 virtual ~InspectorRuntimeAgent(); 54 53 55 54 // Part of the protocol. … … 61 60 void releaseObjectGroup(ErrorString*, const String& objectGroup); 62 61 62 protected: 63 explicit InspectorRuntimeAgent(InjectedScriptManager*); 64 virtual ScriptState* getDefaultInspectedState() = 0; 65 63 66 private: 64 InspectorRuntimeAgent(InjectedScriptManager*, Page*);65 66 67 InjectedScriptManager* m_injectedScriptManager; 67 Page* m_inspectedPage;68 68 }; 69 69
Note: See TracChangeset
for help on using the changeset viewer.