OLD | NEW |
---|---|
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 21 matching lines...) Expand all Loading... | |
32 #define ServiceWorkerGlobalScopeProxy_h | 32 #define ServiceWorkerGlobalScopeProxy_h |
33 | 33 |
34 #include "core/workers/WorkerReportingProxy.h" | 34 #include "core/workers/WorkerReportingProxy.h" |
35 #include "public/platform/WebString.h" | 35 #include "public/platform/WebString.h" |
36 #include "public/web/WebServiceWorkerContextProxy.h" | 36 #include "public/web/WebServiceWorkerContextProxy.h" |
37 #include "wtf/Forward.h" | 37 #include "wtf/Forward.h" |
38 #include "wtf/OwnPtr.h" | 38 #include "wtf/OwnPtr.h" |
39 | 39 |
40 namespace WebCore { | 40 namespace WebCore { |
41 class ExecutionContext; | 41 class ExecutionContext; |
42 class ScriptSourceCode; | |
42 } | 43 } |
43 | 44 |
44 namespace blink { | 45 namespace blink { |
45 | 46 |
46 class WebEmbeddedWorkerImpl; | 47 class WebEmbeddedWorkerImpl; |
47 class WebServiceWorkerContextClient; | 48 class WebServiceWorkerContextClient; |
48 class WebServiceWorkerRequest; | 49 class WebServiceWorkerRequest; |
49 | 50 |
50 // This class is created and destructed on the main thread, but live most | 51 // This class is created and destructed on the main thread, but live most |
51 // of its time as a resident of the worker thread. | 52 // of its time as a resident of the worker thread. |
52 // All methods other than its ctor/dtor are called on the worker thread. | 53 // All methods other than its ctor/dtor are called on the worker thread. |
53 // | 54 // |
54 // This implements WebServiceWorkerContextProxy, which connects ServiceWorker's | 55 // This implements WebServiceWorkerContextProxy, which connects ServiceWorker's |
55 // WorkerGlobalScope and embedder/chrome, and implements ServiceWorker-specific | 56 // WorkerGlobalScope and embedder/chrome, and implements ServiceWorker-specific |
56 // events/upcall methods that are to be called by embedder/chromium, | 57 // events/upcall methods that are to be called by embedder/chromium, |
57 // e.g. onfetch. | 58 // e.g. onfetch. |
58 // | 59 // |
59 // An instance of this class is supposed to outlive until | 60 // An instance of this class is supposed to outlive until |
60 // workerGlobalScopeDestroyed() is called by its corresponding | 61 // workerGlobalScopeDestroyed() is called by its corresponding |
61 // WorkerGlobalScope. | 62 // WorkerGlobalScope. |
62 class ServiceWorkerGlobalScopeProxy FINAL : | 63 class ServiceWorkerGlobalScopeProxy FINAL : |
63 public WebServiceWorkerContextProxy, | 64 public WebServiceWorkerContextProxy, |
64 public WebCore::WorkerReportingProxy { | 65 public WebCore::WorkerReportingProxy { |
65 WTF_MAKE_NONCOPYABLE(ServiceWorkerGlobalScopeProxy); | 66 WTF_MAKE_NONCOPYABLE(ServiceWorkerGlobalScopeProxy); |
66 public: | 67 public: |
67 static PassOwnPtr<ServiceWorkerGlobalScopeProxy> create(WebEmbeddedWorkerImp l&, WebCore::ExecutionContext&, WebServiceWorkerContextClient&); | 68 static PassOwnPtr<ServiceWorkerGlobalScopeProxy> create(WebEmbeddedWorkerImp l&, WebCore::ExecutionContext&, WebServiceWorkerContextClient&); |
68 virtual ~ServiceWorkerGlobalScopeProxy(); | 69 virtual ~ServiceWorkerGlobalScopeProxy(); |
69 | 70 |
71 // Evaluates code in the worker's javascript context. (Can be passed a plai n String.) | |
72 void evaluate(const WebCore::ScriptSourceCode&); | |
dominicc (has gone to gerrit)
2014/07/17 02:43:44
No result?
Jeffrey Yasskin
2014/07/17 16:19:32
Yeah, WorkerScriptController::evaluate() doesn't p
| |
73 | |
70 // WebServiceWorkerContextProxy overrides: | 74 // WebServiceWorkerContextProxy overrides: |
71 virtual void dispatchActivateEvent(int) OVERRIDE; | 75 virtual void dispatchActivateEvent(int) OVERRIDE; |
72 virtual void dispatchInstallEvent(int) OVERRIDE; | 76 virtual void dispatchInstallEvent(int) OVERRIDE; |
73 virtual void dispatchFetchEvent(int, const WebServiceWorkerRequest&) OVERRID E; | 77 virtual void dispatchFetchEvent(int, const WebServiceWorkerRequest&) OVERRID E; |
74 virtual void dispatchMessageEvent(const WebString& message, const WebMessage PortChannelArray&) OVERRIDE; | 78 virtual void dispatchMessageEvent(const WebString& message, const WebMessage PortChannelArray&) OVERRIDE; |
75 virtual void dispatchPushEvent(int, const WebString& data) OVERRIDE; | 79 virtual void dispatchPushEvent(int, const WebString& data) OVERRIDE; |
76 virtual void dispatchSyncEvent(int) OVERRIDE; | 80 virtual void dispatchSyncEvent(int) OVERRIDE; |
81 virtual v8::Handle<v8::Context> v8Context() OVERRIDE; | |
77 | 82 |
78 // WorkerReportingProxy overrides: | 83 // WorkerReportingProxy overrides: |
79 virtual void reportException(const String& errorMessage, int lineNumber, int columnNumber, const String& sourceURL) OVERRIDE; | 84 virtual void reportException(const String& errorMessage, int lineNumber, int columnNumber, const String& sourceURL) OVERRIDE; |
80 virtual void reportConsoleMessage(WebCore::MessageSource, WebCore::MessageLe vel, const String& message, int lineNumber, const String& sourceURL) OVERRIDE; | 85 virtual void reportConsoleMessage(WebCore::MessageSource, WebCore::MessageLe vel, const String& message, int lineNumber, const String& sourceURL) OVERRIDE; |
81 virtual void postMessageToPageInspector(const String&) OVERRIDE; | 86 virtual void postMessageToPageInspector(const String&) OVERRIDE; |
82 virtual void updateInspectorStateCookie(const String&) OVERRIDE; | 87 virtual void updateInspectorStateCookie(const String&) OVERRIDE; |
83 virtual void workerGlobalScopeStarted(WebCore::WorkerGlobalScope*) OVERRIDE; | 88 virtual void workerGlobalScopeStarted(WebCore::WorkerGlobalScope*) OVERRIDE; |
84 virtual void workerGlobalScopeClosed() OVERRIDE; | 89 virtual void workerGlobalScopeClosed() OVERRIDE; |
85 virtual void willDestroyWorkerGlobalScope() OVERRIDE; | 90 virtual void willDestroyWorkerGlobalScope() OVERRIDE; |
86 virtual void workerGlobalScopeDestroyed() OVERRIDE; | 91 virtual void workerGlobalScopeDestroyed() OVERRIDE; |
87 | 92 |
88 private: | 93 private: |
89 ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerImpl&, WebCore::ExecutionCont ext&, WebServiceWorkerContextClient&); | 94 ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerImpl&, WebCore::ExecutionCont ext&, WebServiceWorkerContextClient&); |
90 | 95 |
91 WebEmbeddedWorkerImpl& m_embeddedWorker; | 96 WebEmbeddedWorkerImpl& m_embeddedWorker; |
92 WebCore::ExecutionContext& m_executionContext; | 97 WebCore::ExecutionContext& m_executionContext; |
93 | 98 |
94 WebServiceWorkerContextClient& m_client; | 99 WebServiceWorkerContextClient& m_client; |
95 | 100 |
96 WebCore::WorkerGlobalScope* m_workerGlobalScope; | 101 WebCore::WorkerGlobalScope* m_workerGlobalScope; |
97 }; | 102 }; |
98 | 103 |
99 } // namespace blink | 104 } // namespace blink |
100 | 105 |
101 #endif // ServiceWorkerGlobalScopeProxy_h | 106 #endif // ServiceWorkerGlobalScopeProxy_h |
OLD | NEW |