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

Issue 263143004: Add blink-side plumbing for ServiceWorker -> Document postMessage (1/3) (Closed)

Created:
6 years, 7 months ago by kinuko
Modified:
6 years, 7 months ago
CC:
blink-reviews, jsbell+serviceworker_chromium.org, jamesr, tzik, serviceworker-reviews, nhiroki, abarth-chromium, falken, dglazkov+blink, horo+watch_chromium.org, alecflett+watch_chromium.org, michaeln
Visibility:
Public.

Description

Add blink-side plumbing for ServiceWorker -> Document postMessage - Initialize NavigatorServiceWorker and ServiceWorkerContainer earlier, right after a document is available (for Documents) - Add public interfaces: -- WebServiceWorkerContextClient.postMessageToClient() -- WebServiceWorkerProviderClient.dispatchMessageEvent() This is the first patch for postMessage plumbing: 1/3: THIS PATCH 2/3: https://codereview.chromium.org/246023007/ (chromium) 3/3: https://codereview.chromium.org/264233003/ (blink, adds Layout test) BUG=366063 TEST=to be added after chromium-side change is landed Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=173495 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=173546

Patch Set 1 : #

Total comments: 3

Patch Set 2 : addressed comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+43 lines, -1 line) Patch
M Source/modules/serviceworkers/NavigatorServiceWorker.h View 2 chunks +2 lines, -1 line 0 comments Download
M Source/modules/serviceworkers/NavigatorServiceWorker.cpp View 2 chunks +11 lines, -0 lines 0 comments Download
M Source/modules/serviceworkers/ServiceWorkerContainer.h View 3 chunks +3 lines, -0 lines 0 comments Download
M Source/modules/serviceworkers/ServiceWorkerContainer.cpp View 2 chunks +15 lines, -0 lines 0 comments Download
M Source/web/FrameLoaderClientImpl.cpp View 2 chunks +3 lines, -0 lines 0 comments Download
M public/platform/WebServiceWorkerProviderClient.h View 2 chunks +4 lines, -0 lines 0 comments Download
M public/web/WebServiceWorkerContextClient.h View 1 2 chunks +5 lines, -0 lines 0 comments Download

Messages

Total messages: 18 (0 generated)
kinuko
Haven't fully wired/tested yet, but I think this can work. PTL
6 years, 7 months ago (2014-05-05 17:44:26 UTC) #1
jsbell
Change LGTM but it seems like one of the key files here is (already) violating ...
6 years, 7 months ago (2014-05-05 19:03:05 UTC) #2
jsbell
Oh, and a FIXME somewhere referencing crbug.com/351753 would probably be a good idea.
6 years, 7 months ago (2014-05-05 19:04:38 UTC) #3
kinuko
Thanks, will add a TODO for blob messaging. https://codereview.chromium.org/263143004/diff/10001/public/platform/WebServiceWorkerProviderClient.h File public/platform/WebServiceWorkerProviderClient.h (right): https://codereview.chromium.org/263143004/diff/10001/public/platform/WebServiceWorkerProviderClient.h#newcode40 public/platform/WebServiceWorkerProviderClient.h:40: // ...
6 years, 7 months ago (2014-05-05 23:26:01 UTC) #4
jsbell
https://codereview.chromium.org/263143004/diff/10001/public/platform/WebServiceWorkerProviderClient.h File public/platform/WebServiceWorkerProviderClient.h (right): https://codereview.chromium.org/263143004/diff/10001/public/platform/WebServiceWorkerProviderClient.h#newcode40 public/platform/WebServiceWorkerProviderClient.h:40: // This class provides interface for embedders to talk ...
6 years, 7 months ago (2014-05-06 00:05:21 UTC) #5
kinuko
On 2014/05/06 00:05:21, jsbell wrote: > https://codereview.chromium.org/263143004/diff/10001/public/platform/WebServiceWorkerProviderClient.h > File public/platform/WebServiceWorkerProviderClient.h (right): > > https://codereview.chromium.org/263143004/diff/10001/public/platform/WebServiceWorkerProviderClient.h#newcode40 > ...
6 years, 7 months ago (2014-05-06 00:53:13 UTC) #6
kinuko
Jochen: could you do owner review for public/*, Source/web changes?
6 years, 7 months ago (2014-05-06 07:47:36 UTC) #7
kinuko
On 2014/05/06 07:47:36, kinuko wrote: > Jochen: could you do owner review for public/*, Source/web ...
6 years, 7 months ago (2014-05-07 00:55:05 UTC) #8
jochen (gone - plz use gerrit)
this change lgtm.
6 years, 7 months ago (2014-05-07 06:40:14 UTC) #9
kinuko
The CQ bit was checked by kinuko@chromium.org
6 years, 7 months ago (2014-05-07 07:17:55 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kinuko@chromium.org/263143004/30001
6 years, 7 months ago (2014-05-07 07:19:04 UTC) #11
commit-bot: I haz the power
Change committed as 173495
6 years, 7 months ago (2014-05-07 08:26:42 UTC) #12
loislo
A revert of this CL has been created in https://codereview.chromium.org/270303004/ by loislo@chromium.org. The reason for ...
6 years, 7 months ago (2014-05-07 13:25:47 UTC) #13
kinuko
On 2014/05/07 13:25:47, loislo wrote: > A revert of this CL has been created in ...
6 years, 7 months ago (2014-05-07 15:47:22 UTC) #14
kinuko
The CQ bit was checked by kinuko@chromium.org
6 years, 7 months ago (2014-05-07 17:25:01 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kinuko@chromium.org/263143004/30001
6 years, 7 months ago (2014-05-07 17:26:11 UTC) #16
commit-bot: I haz the power
Change committed as 173546
6 years, 7 months ago (2014-05-07 17:26:46 UTC) #17
commit-bot: I haz the power
6 years, 7 months ago (2014-05-07 17:27:28 UTC) #18
Message was sent while issue was closed.
Failed to apply patch for
Source/modules/serviceworkers/NavigatorServiceWorker.cpp:
While running patch -p1 --forward --force --no-backup-if-mismatch;
  patching file Source/modules/serviceworkers/NavigatorServiceWorker.cpp
  Hunk #1 FAILED at 5.
  Hunk #2 FAILED at 21.
  2 out of 2 hunks FAILED -- saving rejects to file
Source/modules/serviceworkers/NavigatorServiceWorker.cpp.rej

Patch:       Source/modules/serviceworkers/NavigatorServiceWorker.cpp
Index: Source/modules/serviceworkers/NavigatorServiceWorker.cpp
diff --git a/Source/modules/serviceworkers/NavigatorServiceWorker.cpp
b/Source/modules/serviceworkers/NavigatorServiceWorker.cpp
index
57ef2a1511c27e672f5c163ede7eaf9076194398..7591f3bd345e56fb0ebee3f2e3d8d2ca4d0f6d61
100644
--- a/Source/modules/serviceworkers/NavigatorServiceWorker.cpp
+++ b/Source/modules/serviceworkers/NavigatorServiceWorker.cpp
@@ -5,6 +5,7 @@
 #include "config.h"
 #include "modules/serviceworkers/NavigatorServiceWorker.h"
 
+#include "core/dom/Document.h"
 #include "core/frame/DOMWindow.h"
 #include "core/frame/LocalFrame.h"
 #include "core/frame/Navigator.h"
@@ -21,12 +22,22 @@ NavigatorServiceWorker::~NavigatorServiceWorker()
 {
 }
 
+NavigatorServiceWorker* NavigatorServiceWorker::from(Document& document)
+{
+    if (!document.frame() || !document.frame()->domWindow())
+        return 0;
+    Navigator& navigator = document.frame()->domWindow()->navigator();
+    return &from(navigator);
+}
+
 NavigatorServiceWorker& NavigatorServiceWorker::from(Navigator& navigator)
 {
     NavigatorServiceWorker* supplement = toNavigatorServiceWorker(navigator);
     if (!supplement) {
         supplement = new NavigatorServiceWorker(navigator);
         provideTo(navigator, supplementName(), adoptPtrWillBeNoop(supplement));
+        // Initialize ServiceWorkerContainer too.
+        supplement->serviceWorker();
     }
     return *supplement;
 }

Powered by Google App Engine
This is Rietveld 408576698