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

Side by Side Diff: Source/web/ServiceWorkerGlobalScopeProxy.cpp

Issue 180843003: Start to implement FetchEvent for ServiceWorker (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 19 matching lines...) Expand all
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "ServiceWorkerGlobalScopeProxy.h" 32 #include "ServiceWorkerGlobalScopeProxy.h"
33 33
34 #include "WebEmbeddedWorkerImpl.h" 34 #include "WebEmbeddedWorkerImpl.h"
35 #include "WebServiceWorkerContextClient.h" 35 #include "WebServiceWorkerContextClient.h"
36 #include "bindings/v8/WorkerScriptController.h" 36 #include "bindings/v8/WorkerScriptController.h"
37 #include "core/dom/ExecutionContext.h" 37 #include "core/dom/ExecutionContext.h"
38 #include "core/events/ThreadLocalEventNames.h" 38 #include "core/events/ThreadLocalEventNames.h"
39 #include "core/workers/WorkerGlobalScope.h" 39 #include "core/workers/WorkerGlobalScope.h"
40 #include "modules/serviceworkers/FetchEvent.h"
40 #include "modules/serviceworkers/InstallEvent.h" 41 #include "modules/serviceworkers/InstallEvent.h"
41 #include "modules/serviceworkers/WaitUntilObserver.h" 42 #include "modules/serviceworkers/WaitUntilObserver.h"
42 #include "platform/NotImplemented.h" 43 #include "platform/NotImplemented.h"
43 #include "wtf/Functional.h" 44 #include "wtf/Functional.h"
44 #include "wtf/PassOwnPtr.h" 45 #include "wtf/PassOwnPtr.h"
45 46
46 using namespace WebCore; 47 using namespace WebCore;
47 48
48 namespace blink { 49 namespace blink {
49 50
50 PassOwnPtr<ServiceWorkerGlobalScopeProxy> ServiceWorkerGlobalScopeProxy::create( WebEmbeddedWorkerImpl& embeddedWorker, ExecutionContext& executionContext, WebSe rviceWorkerContextClient& client) 51 PassOwnPtr<ServiceWorkerGlobalScopeProxy> ServiceWorkerGlobalScopeProxy::create( WebEmbeddedWorkerImpl& embeddedWorker, ExecutionContext& executionContext, WebSe rviceWorkerContextClient& client)
51 { 52 {
52 return adoptPtr(new ServiceWorkerGlobalScopeProxy(embeddedWorker, executionC ontext, client)); 53 return adoptPtr(new ServiceWorkerGlobalScopeProxy(embeddedWorker, executionC ontext, client));
53 } 54 }
54 55
55 ServiceWorkerGlobalScopeProxy::~ServiceWorkerGlobalScopeProxy() 56 ServiceWorkerGlobalScopeProxy::~ServiceWorkerGlobalScopeProxy()
56 { 57 {
57 } 58 }
58 59
59 void ServiceWorkerGlobalScopeProxy::dispatchInstallEvent(int eventID) 60 void ServiceWorkerGlobalScopeProxy::dispatchInstallEvent(int eventID)
60 { 61 {
61 ASSERT(m_workerGlobalScope); 62 ASSERT(m_workerGlobalScope);
62 RefPtr<WaitUntilObserver> observer = WaitUntilObserver::create(m_workerGloba lScope, eventID); 63 RefPtr<WaitUntilObserver> observer = WaitUntilObserver::create(m_workerGloba lScope, eventID);
63 observer->willDispatchEvent(); 64 observer->willDispatchEvent();
64 m_workerGlobalScope->dispatchEvent(InstallEvent::create(EventTypeNames::inst all, EventInit(), observer)); 65 m_workerGlobalScope->dispatchEvent(InstallEvent::create(EventTypeNames::inst all, EventInit(), observer));
65 observer->didDispatchEvent(); 66 observer->didDispatchEvent();
66 } 67 }
67 68
69 void ServiceWorkerGlobalScopeProxy::dispatchFetchEvent(int eventID)
70 {
71 ASSERT(m_workerGlobalScope);
72 RefPtr<RespondWithObserver> observer = RespondWithObserver::create(m_workerG lobalScope, eventID);
73 m_workerGlobalScope->dispatchEvent(FetchEvent::create(observer));
74 observer->didDispatchEvent();
75 }
76
68 void ServiceWorkerGlobalScopeProxy::reportException(const String& errorMessage, int lineNumber, int columnNumber, const String& sourceURL) 77 void ServiceWorkerGlobalScopeProxy::reportException(const String& errorMessage, int lineNumber, int columnNumber, const String& sourceURL)
69 { 78 {
70 m_client.reportException(errorMessage, lineNumber, columnNumber, sourceURL); 79 m_client.reportException(errorMessage, lineNumber, columnNumber, sourceURL);
71 } 80 }
72 81
73 void ServiceWorkerGlobalScopeProxy::reportConsoleMessage(MessageSource, MessageL evel, const String& message, int lineNumber, const String& sourceURL) 82 void ServiceWorkerGlobalScopeProxy::reportConsoleMessage(MessageSource, MessageL evel, const String& message, int lineNumber, const String& sourceURL)
74 { 83 {
75 notImplemented(); 84 notImplemented();
76 } 85 }
77 86
(...skipping 27 matching lines...) Expand all
105 114
106 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm pl& embeddedWorker, ExecutionContext& executionContext, WebServiceWorkerContextC lient& client) 115 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm pl& embeddedWorker, ExecutionContext& executionContext, WebServiceWorkerContextC lient& client)
107 : m_embeddedWorker(embeddedWorker) 116 : m_embeddedWorker(embeddedWorker)
108 , m_executionContext(executionContext) 117 , m_executionContext(executionContext)
109 , m_client(client) 118 , m_client(client)
110 , m_workerGlobalScope(0) 119 , m_workerGlobalScope(0)
111 { 120 {
112 } 121 }
113 122
114 } // namespace blink 123 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698