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

Unified Diff: public/web/WebServiceWorkerContextClient.h

Issue 61763004: Add EmbeddedWorker interfaces in Blink API (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: public/web/WebServiceWorkerContextClient.h
diff --git a/Source/web/WorkerPermissionClient.h b/public/web/WebServiceWorkerContextClient.h
similarity index 54%
copy from Source/web/WorkerPermissionClient.h
copy to public/web/WebServiceWorkerContextClient.h
index 8abcffb95c2c45e6d78c76d0f15720240f78f434..df4db3083d1ab95898e2b705ecf8e268d06a82c6 100644
--- a/Source/web/WorkerPermissionClient.h
+++ b/public/web/WebServiceWorkerContextClient.h
@@ -28,43 +28,41 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WorkerPermissionClient_h
-#define WorkerPermissionClient_h
+#ifndef WebServiceWorkerContextClient_h
+#define WebServiceWorkerContextClient_h
-#include "core/workers/WorkerClients.h"
-#include "wtf/Forward.h"
-
-namespace WebCore {
-class ExecutionContext;
-}
+#include "WebWorkerPermissionClientProxy.h"
namespace blink {
-class WebFrame;
class WebString;
-class WebWorkerPermissionClientProxy;
+class WebServiceWorkerContextProxy;
-class WorkerPermissionClient : public WebCore::Supplement<WebCore::WorkerClients> {
+// This interface is implemented by the client. It is suppoed to be created
+// on the main thread and then passed on to the worker thread to be owned
+// by a newly created WorkerGlobalScope. All methods of this class are
+// called on the worker thread.
+class WebServiceWorkerContextClient : public WebWorkerPermissionClientProxy {
michaeln 2013/11/12 22:50:00 This derivation seems odd to me too, its not a gen
kinuko 2013/11/18 10:41:13 No. I wanted to make this class as a collection of
public:
- static PassOwnPtr<WorkerPermissionClient> create(PassOwnPtr<WebWorkerPermissionClientProxy>);
-
- virtual ~WorkerPermissionClient();
+ // A new WorkerGlobalScope is created and started to run on the
+ // worker thread.
+ // This also gives back a proxy to the client to talk to the
+ // newly created WorkerGlobalScope. The proxy is held by WorkerGlobalScope
+ // and should not be held by the caller. No proxy methods should be called
+ // after workerContextDestroyed() is called.
+ virtual void workerContextStarted(WebServiceWorkerContextProxy*) { }
- bool allowDatabase(const WebString& name, const WebString& displayName, unsigned long estimatedSize);
- bool allowFileSystem();
- bool allowIndexedDB(const WebString& name);
+ // WorkerGlobalScope.close() is called.
+ virtual void workerContextClosed() { }
- static const char* supplementName();
- static WorkerPermissionClient* from(WebCore::ExecutionContext*);
+ // WorkerGlobalScope is destroyed. The client should clear the
+ // WebServiceWorkerGlobalScopeProxy when this is called.
+ virtual void workerContextDestroyed() { }
-private:
- explicit WorkerPermissionClient(PassOwnPtr<WebWorkerPermissionClientProxy>);
-
- OwnPtr<WebWorkerPermissionClientProxy> m_proxy;
+ virtual void dispatchDevToolsMessage(const WebString&) { }
+ virtual void saveDevToolsAgentState(const WebString&) { }
};
-void providePermissionClientToWorker(WebCore::WorkerClients*, PassOwnPtr<WebWorkerPermissionClientProxy>);
-
} // namespace blink
-#endif // WorkerPermissionClient_h
+#endif // WebWorkerContextClient_h

Powered by Google App Engine
This is Rietveld 408576698