Title: [96710] trunk/Source
Revision
96710
Author
[email protected]
Date
2011-10-05 09:10:31 -0700 (Wed, 05 Oct 2011)

Log Message

Web Inspector: provide a way for persisting worker inspector state
https://bugs.webkit.org/show_bug.cgi?id=69422

Source/WebCore:

Worker inspector can persist and restore its state. InspectorStateClient is
exctracted into a separate interface and has a custom implementation in case
of worker inspector.

Reviewed by Pavel Feldman.

* GNUmakefile.list.am:
* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* inspector/InspectorClient.h:
* inspector/InspectorState.cpp:
(WebCore::InspectorState::InspectorState):
* inspector/InspectorState.h:
* inspector/InspectorStateClient.h: Copied from Source/WebCore/inspector/InspectorClient.h.
(WebCore::InspectorStateClient::~InspectorStateClient):
(WebCore::InspectorStateClient::updateInspectorStateCookie):
* inspector/WorkerInspectorController.cpp:
(WebCore::WorkerInspectorController::WorkerInspectorController):
(WebCore::WorkerInspectorController::restoreInspectorStateFromCookie):
* inspector/WorkerInspectorController.h:
* workers/DefaultSharedWorkerRepository.cpp:
(WebCore::SharedWorkerProxy::postMessageToPageInspector):
(WebCore::SharedWorkerProxy::updateInspectorStateCookie):
* workers/WorkerMessagingProxy.cpp:
(WebCore::WorkerMessagingProxy::updateInspectorStateCookie):
* workers/WorkerMessagingProxy.h:
* workers/WorkerReportingProxy.h:

Source/WebKit/chromium:

Provided an API for saving/restoring worker inspector state.

Reviewed by Pavel Feldman.

* public/WebCommonWorkerClient.h:
(WebKit::WebCommonWorkerClient::saveDevToolsAgentState):
* public/WebSharedWorker.h:
(WebKit::WebSharedWorker::reattachDevTools):
* src/WebSharedWorkerImpl.cpp:
(WebKit::reconnectToWorkerContextInspectorTask):
(WebKit::WebSharedWorkerImpl::reattachDevTools):
* src/WebSharedWorkerImpl.h:
* src/WebWorkerBase.cpp:
(WebKit::WebWorkerBase::updateInspectorStateCookie):
(WebKit::WebWorkerBase::updateInspectorStateCookieTask):
* src/WebWorkerBase.h:
* src/WebWorkerClientImpl.cpp:
(WebKit::WebWorkerClientImpl::updateInspectorStateCookie):
* src/WebWorkerClientImpl.h:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (96709 => 96710)


--- trunk/Source/WebCore/ChangeLog	2011-10-05 16:09:52 UTC (rev 96709)
+++ trunk/Source/WebCore/ChangeLog	2011-10-05 16:10:31 UTC (rev 96710)
@@ -1,3 +1,37 @@
+2011-10-05  Yury Semikhatsky  <[email protected]>
+
+        Web Inspector: provide a way for persisting worker inspector state
+        https://bugs.webkit.org/show_bug.cgi?id=69422
+
+        Worker inspector can persist and restore its state. InspectorStateClient is
+        exctracted into a separate interface and has a custom implementation in case
+        of worker inspector.
+
+        Reviewed by Pavel Feldman.
+
+        * GNUmakefile.list.am:
+        * WebCore.gypi:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * inspector/InspectorClient.h:
+        * inspector/InspectorState.cpp:
+        (WebCore::InspectorState::InspectorState):
+        * inspector/InspectorState.h:
+        * inspector/InspectorStateClient.h: Copied from Source/WebCore/inspector/InspectorClient.h.
+        (WebCore::InspectorStateClient::~InspectorStateClient):
+        (WebCore::InspectorStateClient::updateInspectorStateCookie):
+        * inspector/WorkerInspectorController.cpp:
+        (WebCore::WorkerInspectorController::WorkerInspectorController):
+        (WebCore::WorkerInspectorController::restoreInspectorStateFromCookie):
+        * inspector/WorkerInspectorController.h:
+        * workers/DefaultSharedWorkerRepository.cpp:
+        (WebCore::SharedWorkerProxy::postMessageToPageInspector):
+        (WebCore::SharedWorkerProxy::updateInspectorStateCookie):
+        * workers/WorkerMessagingProxy.cpp:
+        (WebCore::WorkerMessagingProxy::updateInspectorStateCookie):
+        * workers/WorkerMessagingProxy.h:
+        * workers/WorkerReportingProxy.h:
+
 2011-10-05  Abhishek Arya  <[email protected]>
 
         Crash in SVGTRefElement::updateReferencedText.

Modified: trunk/Source/WebCore/GNUmakefile.list.am (96709 => 96710)


--- trunk/Source/WebCore/GNUmakefile.list.am	2011-10-05 16:09:52 UTC (rev 96709)
+++ trunk/Source/WebCore/GNUmakefile.list.am	2011-10-05 16:10:31 UTC (rev 96710)
@@ -2034,6 +2034,7 @@
 	Source/WebCore/inspector/InspectorRuntimeAgent.h \
 	Source/WebCore/inspector/InspectorState.cpp \
 	Source/WebCore/inspector/InspectorState.h \
+	Source/WebCore/inspector/InspectorStateClient.h \
 	Source/WebCore/inspector/InspectorStyleSheet.cpp \
 	Source/WebCore/inspector/InspectorStyleSheet.h \
 	Source/WebCore/inspector/InspectorStyleTextEditor.cpp \

Modified: trunk/Source/WebCore/WebCore.gypi (96709 => 96710)


--- trunk/Source/WebCore/WebCore.gypi	2011-10-05 16:09:52 UTC (rev 96709)
+++ trunk/Source/WebCore/WebCore.gypi	2011-10-05 16:10:31 UTC (rev 96710)
@@ -2712,6 +2712,7 @@
             'inspector/InspectorRuntimeAgent.h',
             'inspector/InspectorState.cpp',
             'inspector/InspectorState.h',
+            'inspector/InspectorStateClient.h',
             'inspector/InspectorStyleSheet.cpp',
             'inspector/InspectorStyleSheet.h',
             'inspector/InspectorStyleTextEditor.cpp',

Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (96709 => 96710)


--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2011-10-05 16:09:52 UTC (rev 96709)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2011-10-05 16:10:31 UTC (rev 96710)
@@ -68910,6 +68910,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\inspector\InspectorStateClient.h"
+				>
+			</File>
+			<File
 				RelativePath="..\inspector\InspectorStyleSheet.cpp"
 				>
 			</File>

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (96709 => 96710)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2011-10-05 16:09:52 UTC (rev 96709)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2011-10-05 16:10:31 UTC (rev 96710)
@@ -5747,6 +5747,7 @@
 		F3D4C47912E07663003DA150 /* InspectorDOMDebuggerAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = F3D4C47712E07663003DA150 /* InspectorDOMDebuggerAgent.h */; };
 		F3F5CF1112ED81A80084C569 /* InspectorConsoleInstrumentation.h in Headers */ = {isa = PBXBuildFile; fileRef = F3F5CF1012ED81A80084C569 /* InspectorConsoleInstrumentation.h */; };
 		F3F5CF1312ED81B30084C569 /* InspectorDatabaseInstrumentation.h in Headers */ = {isa = PBXBuildFile; fileRef = F3F5CF1212ED81B30084C569 /* InspectorDatabaseInstrumentation.h */; };
+		F3F68DA6143CAC5A00C2F887 /* InspectorStateClient.h in Headers */ = {isa = PBXBuildFile; fileRef = F3F68DA5143CAC5A00C2F887 /* InspectorStateClient.h */; };
 		F4EAF4AE10C742B1009100D3 /* OpenTypeSanitizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F4EAF4AC10C742B1009100D3 /* OpenTypeSanitizer.cpp */; };
 		F4EAF4AF10C742B1009100D3 /* OpenTypeSanitizer.h in Headers */ = {isa = PBXBuildFile; fileRef = F4EAF4AD10C742B1009100D3 /* OpenTypeSanitizer.h */; };
 		F5142C69123F12B000F5BD4C /* LocalizedNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = F5142C68123F12B000F5BD4C /* LocalizedNumber.h */; };
@@ -12549,6 +12550,7 @@
 		F3D4C47712E07663003DA150 /* InspectorDOMDebuggerAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorDOMDebuggerAgent.h; sourceTree = "<group>"; };
 		F3F5CF1012ED81A80084C569 /* InspectorConsoleInstrumentation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorConsoleInstrumentation.h; sourceTree = "<group>"; };
 		F3F5CF1212ED81B30084C569 /* InspectorDatabaseInstrumentation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorDatabaseInstrumentation.h; sourceTree = "<group>"; };
+		F3F68DA5143CAC5A00C2F887 /* InspectorStateClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorStateClient.h; sourceTree = "<group>"; };
 		F4EAF4AC10C742B1009100D3 /* OpenTypeSanitizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OpenTypeSanitizer.cpp; path = opentype/OpenTypeSanitizer.cpp; sourceTree = "<group>"; };
 		F4EAF4AD10C742B1009100D3 /* OpenTypeSanitizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OpenTypeSanitizer.h; path = opentype/OpenTypeSanitizer.h; sourceTree = "<group>"; };
 		F5142C68123F12B000F5BD4C /* LocalizedNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalizedNumber.h; sourceTree = "<group>"; };
@@ -13689,6 +13691,7 @@
 				7AF11A5912E727490061F23C /* InspectorRuntimeAgent.h */,
 				4FA3B908125CD12100300BAD /* InspectorState.cpp */,
 				4FA3B909125CD12200300BAD /* InspectorState.h */,
+				F3F68DA5143CAC5A00C2F887 /* InspectorStateClient.h */,
 				82AB176F125C826700C5069D /* InspectorStyleSheet.cpp */,
 				82AB1770125C826700C5069D /* InspectorStyleSheet.h */,
 				82889B4A13C62392009A6156 /* InspectorStyleTextEditor.cpp */,
@@ -23555,6 +23558,7 @@
 				BCEB179C143379F50052EAE9 /* RenderBoxRegionInfo.h in Headers */,
 				59102FBC14327D3B003C9D04 /* ContentSearchUtils.h in Headers */,
 				1AA84F05143BA7BD0051D153 /* ScrollElasticityController.h in Headers */,
+				F3F68DA6143CAC5A00C2F887 /* InspectorStateClient.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Modified: trunk/Source/WebCore/inspector/InspectorClient.h (96709 => 96710)


--- trunk/Source/WebCore/inspector/InspectorClient.h	2011-10-05 16:09:52 UTC (rev 96709)
+++ trunk/Source/WebCore/inspector/InspectorClient.h	2011-10-05 16:10:31 UTC (rev 96710)
@@ -28,6 +28,7 @@
 #define InspectorClient_h
 
 #include "InspectorFrontendChannel.h"
+#include "InspectorStateClient.h"
 #include <wtf/Forward.h>
 
 namespace WebCore {
@@ -36,7 +37,7 @@
 class Node;
 class Page;
 
-class InspectorClient : public InspectorFrontendChannel {
+class InspectorClient : public InspectorFrontendChannel, public InspectorStateClient {
 public:
     virtual ~InspectorClient() { }
 
@@ -47,11 +48,6 @@
     virtual void highlight() = 0;
     virtual void hideHighlight() = 0;
 
-    // Navigation can cause some WebKit implementations to change the view / page / inspector controller instance.
-    // However, there are some inspector controller states that should survive navigation (such as tracking resources
-    // or recording timeline). Following callbacks allow embedders to track these states.
-    virtual void updateInspectorStateCookie(const String&) { };
-
     virtual void clearBrowserCache() { }
     virtual void clearBrowserCookies() { }
 

Modified: trunk/Source/WebCore/inspector/InspectorState.cpp (96709 => 96710)


--- trunk/Source/WebCore/inspector/InspectorState.cpp	2011-10-05 16:09:52 UTC (rev 96709)
+++ trunk/Source/WebCore/inspector/InspectorState.cpp	2011-10-05 16:10:31 UTC (rev 96710)
@@ -31,11 +31,11 @@
 
 #if ENABLE(INSPECTOR)
 
-#include "InspectorClient.h"
+#include "InspectorStateClient.h"
 
 namespace WebCore {
 
-InspectorState::InspectorState(InspectorClient* client)
+InspectorState::InspectorState(InspectorStateClient* client)
     : m_client(client)
     , m_properties(InspectorObject::create())
     , m_isOnMute(false)

Modified: trunk/Source/WebCore/inspector/InspectorState.h (96709 => 96710)


--- trunk/Source/WebCore/inspector/InspectorState.h	2011-10-05 16:09:52 UTC (rev 96709)
+++ trunk/Source/WebCore/inspector/InspectorState.h	2011-10-05 16:10:31 UTC (rev 96710)
@@ -41,11 +41,11 @@
 
 namespace WebCore {
 
-class InspectorClient;
+class InspectorStateClient;
 
 class InspectorState {
 public:
-    InspectorState(InspectorClient*);
+    InspectorState(InspectorStateClient*);
     virtual ~InspectorState() {}
 
     void loadFromCookie(const String& inspectorStateCookie);
@@ -67,7 +67,7 @@
     void updateCookie();
     void setValue(const String& propertyName, PassRefPtr<InspectorValue>);
 
-    InspectorClient* m_client;
+    InspectorStateClient* m_client;
     RefPtr<InspectorObject> m_properties;
     bool m_isOnMute;
 };

Copied: trunk/Source/WebCore/inspector/InspectorStateClient.h (from rev 96708, trunk/Source/WebCore/inspector/InspectorClient.h) (0 => 96710)


--- trunk/Source/WebCore/inspector/InspectorStateClient.h	                        (rev 0)
+++ trunk/Source/WebCore/inspector/InspectorStateClient.h	2011-10-05 16:10:31 UTC (rev 96710)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2011 Google Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef InspectorStateClient_h
+#define InspectorStateClient_h
+
+#include <wtf/Forward.h>
+
+namespace WebCore {
+
+class InspectorStateClient {
+public:
+    virtual ~InspectorStateClient() { }
+
+    // Navigation can cause some WebKit implementations to change the view / page / inspector controller instance.
+    // However, there are some inspector controller states that should survive navigation (such as tracking resources
+    // or recording timeline) and worker restart. Following callbacks allow embedders to track these states.
+    virtual void updateInspectorStateCookie(const String&) { };
+};
+
+} // namespace WebCore
+
+#endif // !defined(InspectorStateClient_h)

Modified: trunk/Source/WebCore/inspector/WorkerInspectorController.cpp (96709 => 96710)


--- trunk/Source/WebCore/inspector/WorkerInspectorController.cpp	2011-10-05 16:09:52 UTC (rev 96709)
+++ trunk/Source/WebCore/inspector/WorkerInspectorController.cpp	2011-10-05 16:10:31 UTC (rev 96710)
@@ -42,6 +42,7 @@
 #include "InspectorFrontendChannel.h"
 #include "InspectorRuntimeAgent.h"
 #include "InspectorState.h"
+#include "InspectorStateClient.h"
 #include "InstrumentingAgents.h"
 #include "WorkerContext.h"
 #include "WorkerDebuggerAgent.h"
@@ -87,11 +88,26 @@
     WorkerContext* m_workerContext;
 };
 
+class WorkerStateClient : public InspectorStateClient {
+public:
+    WorkerStateClient(WorkerContext* context) : m_workerContext(context) { }
+    virtual ~WorkerStateClient() { }
+
+private:
+    virtual void updateInspectorStateCookie(const String& cookie)
+    {
+        m_workerContext->thread()->workerReportingProxy().updateInspectorStateCookie(cookie);
+    }
+
+    WorkerContext* m_workerContext;
+};
+
 }
 
 WorkerInspectorController::WorkerInspectorController(WorkerContext* workerContext)
     : m_workerContext(workerContext)
-    , m_state(adoptPtr(new InspectorState(0)))
+    , m_stateClient(adoptPtr(new WorkerStateClient(workerContext)))
+    , m_state(adoptPtr(new InspectorState(m_stateClient.get())))
     , m_instrumentingAgents(adoptPtr(new InstrumentingAgents()))
     , m_injectedScriptManager(InjectedScriptManager::createForWorker())
 #if ENABLE(_javascript__DEBUGGER)
@@ -176,6 +192,17 @@
     m_frontendChannel.clear();
 }
 
+void WorkerInspectorController::restoreInspectorStateFromCookie(const String& inspectorCookie)
+{
+    ASSERT(!m_inspectorFrontend);
+    connectFrontend();
+    m_state->loadFromCookie(inspectorCookie);
+
+#if ENABLE(_javascript__DEBUGGER)
+    m_debuggerAgent->restore();
+#endif
+}
+
 void WorkerInspectorController::dispatchMessageFromFrontend(const String& message)
 {
     if (m_backendDispatcher)

Modified: trunk/Source/WebCore/inspector/WorkerInspectorController.h (96709 => 96710)


--- trunk/Source/WebCore/inspector/WorkerInspectorController.h	2011-10-05 16:09:52 UTC (rev 96709)
+++ trunk/Source/WebCore/inspector/WorkerInspectorController.h	2011-10-05 16:10:31 UTC (rev 96710)
@@ -51,6 +51,7 @@
 class InspectorInstrumentation;
 class InspectorRuntimeAgent;
 class InspectorState;
+class InspectorStateClient;
 class InstrumentingAgents;
 class WorkerContext;
 
@@ -63,12 +64,14 @@
 
     void connectFrontend();
     void disconnectFrontend();
+    void restoreInspectorStateFromCookie(const String& inspectorCookie);
     void dispatchMessageFromFrontend(const String&);
 
 private:
     friend InstrumentingAgents* instrumentationForWorkerContext(WorkerContext*);
 
     WorkerContext* m_workerContext;
+    OwnPtr<InspectorStateClient> m_stateClient;
     OwnPtr<InspectorState> m_state;
     OwnPtr<InstrumentingAgents> m_instrumentingAgents;
     OwnPtr<InjectedScriptManager> m_injectedScriptManager;

Modified: trunk/Source/WebCore/workers/DefaultSharedWorkerRepository.cpp (96709 => 96710)


--- trunk/Source/WebCore/workers/DefaultSharedWorkerRepository.cpp	2011-10-05 16:09:52 UTC (rev 96709)
+++ trunk/Source/WebCore/workers/DefaultSharedWorkerRepository.cpp	2011-10-05 16:10:31 UTC (rev 96710)
@@ -83,6 +83,7 @@
     virtual void postConsoleMessageToWorkerObject(MessageSource, MessageType, MessageLevel, const String& message, int lineNumber, const String& sourceURL);
 #if ENABLE(INSPECTOR)
     virtual void postMessageToPageInspector(const String&);
+    virtual void updateInspectorStateCookie(const String&);
 #endif
     virtual void workerContextClosed();
     virtual void workerContextDestroyed();
@@ -184,7 +185,13 @@
 #if ENABLE(INSPECTOR)
 void SharedWorkerProxy::postMessageToPageInspector(const String&)
 {
+    notImplemented();
 }
+
+void SharedWorkerProxy::updateInspectorStateCookie(const String&)
+{
+    notImplemented();
+}
 #endif
 
 void SharedWorkerProxy::workerContextClosed()

Modified: trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp (96709 => 96710)


--- trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp	2011-10-05 16:09:52 UTC (rev 96709)
+++ trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp	2011-10-05 16:10:31 UTC (rev 96710)
@@ -40,6 +40,7 @@
 #include "ExceptionCode.h"
 #include "InspectorInstrumentation.h"
 #include "MessageEvent.h"
+#include "NotImplemented.h"
 #include "ScriptCallStack.h"
 #include "ScriptExecutionContext.h"
 #include "Worker.h"
@@ -438,6 +439,11 @@
 {
     m_scriptExecutionContext->postTask(PostMessageToPageInspectorTask::create(this, message));
 }
+
+void WorkerMessagingProxy::updateInspectorStateCookie(const String&)
+{
+    notImplemented();
+}
 #endif
 
 void WorkerMessagingProxy::confirmMessageFromWorkerObject(bool hasPendingActivity)

Modified: trunk/Source/WebCore/workers/WorkerMessagingProxy.h (96709 => 96710)


--- trunk/Source/WebCore/workers/WorkerMessagingProxy.h	2011-10-05 16:09:52 UTC (rev 96709)
+++ trunk/Source/WebCore/workers/WorkerMessagingProxy.h	2011-10-05 16:10:31 UTC (rev 96710)
@@ -71,6 +71,7 @@
         virtual void postConsoleMessageToWorkerObject(MessageSource, MessageType, MessageLevel, const String& message, int lineNumber, const String& sourceURL);
 #if ENABLE(INSPECTOR)
         virtual void postMessageToPageInspector(const String&);
+        virtual void updateInspectorStateCookie(const String&);
 #endif
         virtual void confirmMessageFromWorkerObject(bool hasPendingActivity);
         virtual void reportPendingActivity(bool hasPendingActivity);

Modified: trunk/Source/WebCore/workers/WorkerReportingProxy.h (96709 => 96710)


--- trunk/Source/WebCore/workers/WorkerReportingProxy.h	2011-10-05 16:09:52 UTC (rev 96709)
+++ trunk/Source/WebCore/workers/WorkerReportingProxy.h	2011-10-05 16:10:31 UTC (rev 96710)
@@ -48,6 +48,7 @@
         virtual void postConsoleMessageToWorkerObject(MessageSource, MessageType, MessageLevel, const String& message, int lineNumber, const String& sourceURL) = 0;
 #if ENABLE(INSPECTOR)
         virtual void postMessageToPageInspector(const String&) = 0;
+        virtual void updateInspectorStateCookie(const String&) = 0;
 #endif
         // Invoked when close() is invoked on the worker context.
         virtual void workerContextClosed() = 0;

Modified: trunk/Source/WebKit/chromium/ChangeLog (96709 => 96710)


--- trunk/Source/WebKit/chromium/ChangeLog	2011-10-05 16:09:52 UTC (rev 96709)
+++ trunk/Source/WebKit/chromium/ChangeLog	2011-10-05 16:10:31 UTC (rev 96710)
@@ -1,3 +1,28 @@
+2011-10-05  Yury Semikhatsky  <[email protected]>
+
+        Web Inspector: provide a way for persisting worker inspector state
+        https://bugs.webkit.org/show_bug.cgi?id=69422
+
+        Provided an API for saving/restoring worker inspector state.
+
+        Reviewed by Pavel Feldman.
+
+        * public/WebCommonWorkerClient.h:
+        (WebKit::WebCommonWorkerClient::saveDevToolsAgentState):
+        * public/WebSharedWorker.h:
+        (WebKit::WebSharedWorker::reattachDevTools):
+        * src/WebSharedWorkerImpl.cpp:
+        (WebKit::reconnectToWorkerContextInspectorTask):
+        (WebKit::WebSharedWorkerImpl::reattachDevTools):
+        * src/WebSharedWorkerImpl.h:
+        * src/WebWorkerBase.cpp:
+        (WebKit::WebWorkerBase::updateInspectorStateCookie):
+        (WebKit::WebWorkerBase::updateInspectorStateCookieTask):
+        * src/WebWorkerBase.h:
+        * src/WebWorkerClientImpl.cpp:
+        (WebKit::WebWorkerClientImpl::updateInspectorStateCookie):
+        * src/WebWorkerClientImpl.h:
+
 2011-10-04  Yury Semikhatsky  <[email protected]>
 
         [Chromium] Web Inspector: save inspector state into single string instead of string map

Modified: trunk/Source/WebKit/chromium/public/WebCommonWorkerClient.h (96709 => 96710)


--- trunk/Source/WebKit/chromium/public/WebCommonWorkerClient.h	2011-10-05 16:09:52 UTC (rev 96709)
+++ trunk/Source/WebKit/chromium/public/WebCommonWorkerClient.h	2011-10-05 16:10:31 UTC (rev 96710)
@@ -111,6 +111,7 @@
     }
 
     virtual void dispatchDevToolsMessage(const WebString&) { }
+    virtual void saveDevToolsAgentState(const WebString&) { }
 
 protected:
     ~WebCommonWorkerClient() { }

Modified: trunk/Source/WebKit/chromium/public/WebSharedWorker.h (96709 => 96710)


--- trunk/Source/WebKit/chromium/public/WebSharedWorker.h	2011-10-05 16:09:52 UTC (rev 96709)
+++ trunk/Source/WebKit/chromium/public/WebSharedWorker.h	2011-10-05 16:10:31 UTC (rev 96710)
@@ -79,6 +79,7 @@
     virtual void clientDestroyed() = 0;
 
     virtual void attachDevTools() { }
+    virtual void reattachDevTools(const WebString& savedState) { }
     virtual void detachDevTools() { }
     virtual void dispatchDevToolsMessage(const WebString&) { }
 };

Modified: trunk/Source/WebKit/chromium/src/WebSharedWorkerImpl.cpp (96709 => 96710)


--- trunk/Source/WebKit/chromium/src/WebSharedWorkerImpl.cpp	2011-10-05 16:09:52 UTC (rev 96709)
+++ trunk/Source/WebKit/chromium/src/WebSharedWorkerImpl.cpp	2011-10-05 16:10:31 UTC (rev 96710)
@@ -122,6 +122,18 @@
     workerThread()->runLoop().postTask(createCallbackTask(connectToWorkerContextInspectorTask, true));
 }
 
+static void reconnectToWorkerContextInspectorTask(ScriptExecutionContext* context, const String& savedState)
+{
+    ASSERT(context->isWorkerContext());
+    WorkerInspectorController* ic = static_cast<WorkerContext*>(context)->workerInspectorController();
+    ic->restoreInspectorStateFromCookie(savedState);
+}
+
+void WebSharedWorkerImpl::reattachDevTools(const WebString& savedState)
+{
+    workerThread()->runLoop().postTaskForMode(createCallbackTask(reconnectToWorkerContextInspectorTask, String(savedState)), WorkerScriptDebugServer::debuggerTaskMode);
+}
+
 static void disconnectFromWorkerContextInspectorTask(ScriptExecutionContext* context, bool)
 {
     ASSERT(context->isWorkerContext());

Modified: trunk/Source/WebKit/chromium/src/WebSharedWorkerImpl.h (96709 => 96710)


--- trunk/Source/WebKit/chromium/src/WebSharedWorkerImpl.h	2011-10-05 16:09:52 UTC (rev 96709)
+++ trunk/Source/WebKit/chromium/src/WebSharedWorkerImpl.h	2011-10-05 16:10:31 UTC (rev 96710)
@@ -57,6 +57,7 @@
     virtual void clientDestroyed();
 
     virtual void attachDevTools();
+    virtual void reattachDevTools(const WebString& savedState);
     virtual void detachDevTools();
     virtual void dispatchDevToolsMessage(const WebString&);
 

Modified: trunk/Source/WebKit/chromium/src/WebWorkerBase.cpp (96709 => 96710)


--- trunk/Source/WebKit/chromium/src/WebWorkerBase.cpp	2011-10-05 16:09:52 UTC (rev 96709)
+++ trunk/Source/WebKit/chromium/src/WebWorkerBase.cpp	2011-10-05 16:10:31 UTC (rev 96710)
@@ -244,6 +244,18 @@
     thisPtr->commonClient()->dispatchDevToolsMessage(message);
 }
 
+void WebWorkerBase::updateInspectorStateCookie(const WTF::String& cookie)
+{
+    dispatchTaskToMainThread(createCallbackTask(&updateInspectorStateCookieTask, AllowCrossThreadAccess(this), cookie));
+}
+
+void WebWorkerBase::updateInspectorStateCookieTask(ScriptExecutionContext*, WebWorkerBase* thisPtr, const String& cookie)
+{
+    if (!thisPtr->commonClient())
+        return;
+    thisPtr->commonClient()->saveDevToolsAgentState(cookie);
+}
+
 void WebWorkerBase::confirmMessageFromWorkerObject(bool hasPendingActivity)
 {
     dispatchTaskToMainThread(createCallbackTask(&confirmMessageTask, AllowCrossThreadAccess(this),

Modified: trunk/Source/WebKit/chromium/src/WebWorkerBase.h (96709 => 96710)


--- trunk/Source/WebKit/chromium/src/WebWorkerBase.h	2011-10-05 16:09:52 UTC (rev 96709)
+++ trunk/Source/WebKit/chromium/src/WebWorkerBase.h	2011-10-05 16:10:31 UTC (rev 96710)
@@ -87,6 +87,7 @@
         WebCore::MessageSource, WebCore::MessageType,
         WebCore::MessageLevel, const WTF::String&, int, const WTF::String&);
     virtual void postMessageToPageInspector(const WTF::String&);
+    virtual void updateInspectorStateCookie(const WTF::String&);
     virtual void confirmMessageFromWorkerObject(bool);
     virtual void reportPendingActivity(bool);
     virtual void workerContextClosed();
@@ -144,6 +145,7 @@
         int lineNumber,
         const WTF::String& sourceURL);
     static void postMessageToPageInspectorTask(WebCore::ScriptExecutionContext*, WebWorkerBase*, const WTF::String&);
+    static void updateInspectorStateCookieTask(WebCore::ScriptExecutionContext*, WebWorkerBase* thisPtr, const WTF::String& cookie);
     static void confirmMessageTask(
         WebCore::ScriptExecutionContext* context,
         WebWorkerBase* thisPtr,

Modified: trunk/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp (96709 => 96710)


--- trunk/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp	2011-10-05 16:09:52 UTC (rev 96709)
+++ trunk/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp	2011-10-05 16:10:31 UTC (rev 96710)
@@ -137,6 +137,10 @@
 {
     m_proxy->postMessageToPageInspector(message);
 }
+
+void WebWorkerClientImpl::updateInspectorStateCookie(const String&)
+{
+}
 #endif // ENABLE(INSPECTOR)
 
 

Modified: trunk/Source/WebKit/chromium/src/WebWorkerClientImpl.h (96709 => 96710)


--- trunk/Source/WebKit/chromium/src/WebWorkerClientImpl.h	2011-10-05 16:09:52 UTC (rev 96709)
+++ trunk/Source/WebKit/chromium/src/WebWorkerClientImpl.h	2011-10-05 16:10:31 UTC (rev 96710)
@@ -82,6 +82,7 @@
     virtual void disconnectFromInspector();
     virtual void sendMessageToInspector(const String&);
     virtual void postMessageToPageInspector(const String&);
+    virtual void updateInspectorStateCookie(const String&);
 #endif
     // WebCore::WorkerLoaderProxy methods:
     virtual void postTaskToLoader(PassOwnPtr<WebCore::ScriptExecutionContext::Task>);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to