2011-01-11 Pavel Feldman <pfeldman@chromium.org>
authorpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Jan 2011 12:31:48 +0000 (12:31 +0000)
committerpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Jan 2011 12:31:48 +0000 (12:31 +0000)
        Reviewed by Yury Semikhatsky.

        Chromium DevTools: get rid of APU-related code in WebKit/chromium.
        https://bugs.webkit.org/show_bug.cgi?id=52152

        * inspector/InspectorController.cpp:
        (WebCore::InspectorController::restoreInspectorStateFromCookie):
        (WebCore::InspectorController::setInjectedScriptSource):
        * inspector/InspectorState.cpp:
        (WebCore::InspectorState::InspectorState):
        * inspector/InspectorState.h:
        * inspector/front-end/inspector.js:
2011-01-11  Pavel Feldman  <pfeldman@chromium.org>

        Reviewed by Yury Semikhatsky.

        Chromium DevTools: get rid of APU-related code in WebKit/chromium.
        https://bugs.webkit.org/show_bug.cgi?id=52152

        * src/WebDevToolsAgentImpl.cpp:
        (WebKit::WebDevToolsAgentImpl::WebDevToolsAgentImpl):
        (WebKit::WebDevToolsAgentImpl::detach):
        (WebKit::WebDevToolsAgentImpl::frontendLoaded):
        (WebKit::WebDevToolsAgentImpl::setRuntimeProperty):
        (WebKit::WebDevToolsAgentImpl::sendMessageToFrontend):
        * src/WebDevToolsAgentImpl.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@75486 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorController.cpp
Source/WebCore/inspector/InspectorState.cpp
Source/WebCore/inspector/InspectorState.h
Source/WebCore/inspector/front-end/inspector.js
WebKit/chromium/ChangeLog
WebKit/chromium/src/WebDevToolsAgentImpl.cpp
WebKit/chromium/src/WebDevToolsAgentImpl.h

index b94d6b2..d40995d 100644 (file)
@@ -2,6 +2,21 @@
 
         Reviewed by Yury Semikhatsky.
 
+        Chromium DevTools: get rid of APU-related code in WebKit/chromium.
+        https://bugs.webkit.org/show_bug.cgi?id=52152
+
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::restoreInspectorStateFromCookie):
+        (WebCore::InspectorController::setInjectedScriptSource):
+        * inspector/InspectorState.cpp:
+        (WebCore::InspectorState::InspectorState):
+        * inspector/InspectorState.h:
+        * inspector/front-end/inspector.js:
+
+2011-01-11  Pavel Feldman  <pfeldman@chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
         Web Inspector: [REGRESSION] Load timing is requested
         for all resources (not only for the main one).
         https://bugs.webkit.org/show_bug.cgi?id=51749
index 31b6b9c..b0babdc 100644 (file)
@@ -230,12 +230,23 @@ void InspectorController::getInspectorState(RefPtr<InspectorObject>* state)
 void InspectorController::restoreInspectorStateFromCookie(const String& inspectorStateCookie)
 {
     m_state->restoreFromInspectorCookie(inspectorStateCookie);
+
+    String injectedScriptSource = m_state->getString(InspectorState::injectedScriptSource);
+    if (!injectedScriptSource.isEmpty())
+        injectedScriptHost()->setInjectedScriptSource(injectedScriptSource);
+
+    if (!m_frontend)
+        connectFrontend();
+
     if (m_state->getBoolean(InspectorState::timelineProfilerEnabled))
         startTimelineProfiler();
+
 #if ENABLE(JAVASCRIPT_DEBUGGER)
+    restoreDebugger();
+    restoreProfiler(ProfilerRestoreResetAgent);
     if (m_state->getBoolean(InspectorState::userInitiatedProfiling))
         startUserInitiatedProfiling();
-#endif    
+#endif
 }
 
 void InspectorController::inspect(Node* node)
@@ -500,13 +511,6 @@ void InspectorController::connectFrontend()
     InspectorInstrumentation::frontendCreated();
 }
 
-void InspectorController::reuseFrontend()
-{
-    connectFrontend();
-    restoreDebugger();
-    restoreProfiler(ProfilerRestoreResetAgent);
-}
-
 void InspectorController::show()
 {
     if (!enabled())
@@ -1428,6 +1432,7 @@ bool InspectorController::hasXHRBreakpoint(const String& url, String* breakpoint
 void InspectorController::setInjectedScriptSource(const String& source)
 {
      injectedScriptHost()->setInjectedScriptSource(source);
+     m_state->setString(InspectorState::injectedScriptSource, source);
 }
 
 void InspectorController::dispatchOnInjectedScript(long injectedScriptId, const String& methodName, const String& arguments, RefPtr<InspectorValue>* result, bool* hadException)
index 0865648..591eedd 100644 (file)
@@ -50,6 +50,7 @@ InspectorState::InspectorState(InspectorClient* client)
     registerBoolean(consoleMessagesEnabled, false, "consoleMessagesEnabled", String());
     registerBoolean(userInitiatedProfiling, false, "userInitiatedProfiling", String());
     registerObject(stickyBreakpoints, String(), String());
+    registerString(injectedScriptSource, String(), String(), String());
 }
 
 void InspectorState::restoreFromInspectorCookie(const String& json)
index 4f57da7..56ab507 100644 (file)
@@ -56,6 +56,7 @@ public:
         consoleMessagesEnabled,
         userInitiatedProfiling,
         stickyBreakpoints,
+        injectedScriptSource,
         lastPropertyId
     };
 
index 33a75d7..b1f0c78 100644 (file)
@@ -493,6 +493,7 @@ WebInspector.loaded = function()
 WebInspector.doLoadedDone = function()
 {
     InspectorBackend.setInjectedScriptSource("(" + injectedScriptConstructor + ");");
+    InspectorFrontendHost.loaded();
 
     var platform = WebInspector.platform;
     document.body.addStyleClass("platform-" + platform);
@@ -502,7 +503,6 @@ WebInspector.doLoadedDone = function()
     var port = WebInspector.port;
     document.body.addStyleClass("port-" + port);
 
-    InspectorFrontendHost.loaded();
     WebInspector.settings = new WebInspector.Settings();
 
     this._registerShortcuts();
index 41c2801..9a4b9ad 100644 (file)
@@ -1,3 +1,18 @@
+2011-01-11  Pavel Feldman  <pfeldman@chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        Chromium DevTools: get rid of APU-related code in WebKit/chromium.
+        https://bugs.webkit.org/show_bug.cgi?id=52152
+
+        * src/WebDevToolsAgentImpl.cpp:
+        (WebKit::WebDevToolsAgentImpl::WebDevToolsAgentImpl):
+        (WebKit::WebDevToolsAgentImpl::detach):
+        (WebKit::WebDevToolsAgentImpl::frontendLoaded):
+        (WebKit::WebDevToolsAgentImpl::setRuntimeProperty):
+        (WebKit::WebDevToolsAgentImpl::sendMessageToFrontend):
+        * src/WebDevToolsAgentImpl.h:
+
 2011-01-10  Adam Barth  <abarth@webkit.org>
 
         Reviewed by Darin Adler.
index 9f4ce87..dbd6dca 100644 (file)
@@ -83,7 +83,6 @@ namespace WebKit {
 
 namespace {
 
-static const char kApuAgentFeatureName[] = "apu-agent";
 static const char kFrontendConnectedFeatureName[] = "frontend-connected";
 static const char kInspectorStateFeatureName[] = "inspector-state";
 
@@ -179,7 +178,6 @@ WebDevToolsAgentImpl::WebDevToolsAgentImpl(
     : m_hostId(client->hostIdentifier())
     , m_client(client)
     , m_webViewImpl(webViewImpl)
-    , m_apuAgentEnabled(false)
     , m_attached(false)
 {
     DebuggerAgentManager::setExposeV8DebuggerProtocol(
@@ -217,12 +215,11 @@ void WebDevToolsAgentImpl::detach()
     ic->close();
     m_debuggerAgentImpl.set(0);
     m_attached = false;
-    m_apuAgentEnabled = false;
 }
 
 void WebDevToolsAgentImpl::frontendLoaded()
 {
-    connectFrontend(false);
+    inspectorController()->connectFrontend();
 }
 
 void WebDevToolsAgentImpl::didNavigate()
@@ -256,45 +253,12 @@ void WebDevToolsAgentImpl::inspectNode(v8::Handle<v8::Value> node)
 
 void WebDevToolsAgentImpl::setRuntimeProperty(const WebString& name, const WebString& value)
 {
-    if (name == kApuAgentFeatureName)
-        setApuAgentEnabled(value == "true");
-    else if (name == kInspectorStateFeatureName) {
+    if (name == kInspectorStateFeatureName) {
         InspectorController* ic = inspectorController();
         ic->restoreInspectorStateFromCookie(value);
-    } else if (name == kFrontendConnectedFeatureName && !inspectorController()->hasFrontend()) {
-        inspectorController()->injectedScriptHost()->setInjectedScriptSource(value);
-        connectFrontend(true);
     }
 }
 
-void WebDevToolsAgentImpl::setApuAgentEnabled(bool enabled)
-{
-    m_apuAgentEnabled = enabled;
-    InspectorController* ic = inspectorController();
-    if (enabled) {
-        if (!ic->hasFrontend())
-            connectFrontend(true);
-
-        ic->startTimelineProfiler();
-        m_debuggerAgentImpl->setAutoContinueOnException(true);
-    } else
-      ic->stopTimelineProfiler();
-
-    m_client->runtimePropertyChanged(
-        kApuAgentFeatureName,
-        enabled ? String("true") : String("false"));
-}
-
-void WebDevToolsAgentImpl::connectFrontend(bool afterNavigation)
-{
-    if (afterNavigation)
-        inspectorController()->reuseFrontend();
-    else
-        inspectorController()->connectFrontend();
-    // We know that by this time injected script has already been pushed to the backend.
-    m_client->runtimePropertyChanged(kFrontendConnectedFeatureName, inspectorController()->injectedScriptHost()->injectedScriptSource());
-}
-
 WebCore::InspectorController* WebDevToolsAgentImpl::inspectorController()
 {
     if (Page* page = m_webViewImpl->page())
@@ -398,11 +362,6 @@ bool WebDevToolsAgentImpl::sendMessageToFrontend(const WTF::String& message)
     if (!devToolsAgent)
         return false;
 
-    if (devToolsAgent->m_apuAgentEnabled) {
-        m_client->sendDispatchToAPU(message);
-        return true;
-    }
-
     m_client->sendMessageToInspectorFrontend(message);
     return true;
 }
index 487cf0c..9b3c053 100644 (file)
@@ -100,16 +100,12 @@ public:
     int hostId() { return m_hostId; }
 
 private:
-    void setApuAgentEnabled(bool enabled);
-    void connectFrontend(bool afterNavigation);
-
     WebCore::InspectorController* inspectorController();
 
     int m_hostId;
     WebDevToolsAgentClient* m_client;
     WebViewImpl* m_webViewImpl;
     OwnPtr<DebuggerAgentImpl> m_debuggerAgentImpl;
-    bool m_apuAgentEnabled;
     bool m_attached;
 };