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

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: updated 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 55%
copy from Source/web/WorkerPermissionClient.h
copy to public/web/WebServiceWorkerContextClient.h
index 8abcffb95c2c45e6d78c76d0f15720240f78f434..4ee02d16431aa2dc26f6eaea9e63421a24cd38e7 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:
- 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