| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_WORKER_WEBWORKER_STUB_BASE_H_ | |
| 6 #define CONTENT_WORKER_WEBWORKER_STUB_BASE_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "content/worker/webworkerclient_proxy.h" | |
| 11 #include "content/worker/worker_webapplicationcachehost_impl.h" | |
| 12 #include "ipc/ipc_channel.h" | |
| 13 | |
| 14 // This class is the common base class for both WebWorkerStub and | |
| 15 // WebSharedWorkerStub and contains common setup/teardown functionality. | |
| 16 class WebWorkerStubBase : public IPC::Channel::Listener { | |
| 17 public: | |
| 18 WebWorkerStubBase(int route_id, | |
| 19 const WorkerAppCacheInitInfo& appcache_init_info); | |
| 20 virtual ~WebWorkerStubBase(); | |
| 21 | |
| 22 // Invoked when the WebWorkerClientProxy is shutting down. | |
| 23 void Shutdown(); | |
| 24 | |
| 25 // Called after terminating the worker context to make sure that the worker | |
| 26 // actually terminates (is not stuck in an infinite loop). | |
| 27 void EnsureWorkerContextTerminates(); | |
| 28 | |
| 29 WebWorkerClientProxy* client() { return &client_; } | |
| 30 | |
| 31 const WorkerAppCacheInitInfo& appcache_init_info() const { | |
| 32 return appcache_init_info_; | |
| 33 } | |
| 34 | |
| 35 // Returns the script url of this worker. | |
| 36 virtual const GURL& url() const = 0; | |
| 37 | |
| 38 private: | |
| 39 int route_id_; | |
| 40 WorkerAppCacheInitInfo appcache_init_info_; | |
| 41 | |
| 42 // WebWorkerClient that responds to outgoing API calls from the worker object. | |
| 43 WebWorkerClientProxy client_; | |
| 44 | |
| 45 DISALLOW_COPY_AND_ASSIGN(WebWorkerStubBase); | |
| 46 }; | |
| 47 | |
| 48 #endif // CONTENT_WORKER_WEBWORKER_STUB_BASE_H_ | |
| OLD | NEW |