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

Side by Side Diff: content/browser/service_worker/service_worker_context_wrapper.h

Issue 325173002: ServiceWorker: Confirm the liveness of the associated context before handling message (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 11 matching lines...) Expand all
22 22
23 namespace quota { 23 namespace quota {
24 class QuotaManagerProxy; 24 class QuotaManagerProxy;
25 } 25 }
26 26
27 namespace content { 27 namespace content {
28 28
29 class BrowserContext; 29 class BrowserContext;
30 class ServiceWorkerContextCore; 30 class ServiceWorkerContextCore;
31 class ServiceWorkerContextObserver; 31 class ServiceWorkerContextObserver;
32 class ServiceWorkerProviderHostRegistry;
32 33
33 // A refcounted wrapper class for our core object. Higher level content lib 34 // A refcounted wrapper class for our core object. Higher level content lib
34 // classes keep references to this class on mutliple threads. The inner core 35 // classes keep references to this class on mutliple threads. The inner core
35 // instance is strictly single threaded and is not refcounted, the core object 36 // instance is strictly single threaded and is not refcounted, the core object
36 // is what is used internally in the service worker lib. 37 // is what is used internally in the service worker lib.
37 class CONTENT_EXPORT ServiceWorkerContextWrapper 38 class CONTENT_EXPORT ServiceWorkerContextWrapper
38 : NON_EXPORTED_BASE(public ServiceWorkerContext), 39 : NON_EXPORTED_BASE(public ServiceWorkerContext),
39 public base::RefCountedThreadSafe<ServiceWorkerContextWrapper> { 40 public base::RefCountedThreadSafe<ServiceWorkerContextWrapper> {
40 public: 41 public:
41 ServiceWorkerContextWrapper(BrowserContext* browser_context); 42 ServiceWorkerContextWrapper(BrowserContext* browser_context);
42 43
43 // Init and Shutdown are for use on the UI thread when the profile, 44 // Init and Shutdown are for use on the UI thread when the profile,
44 // storagepartition is being setup and torn down. 45 // storagepartition is being setup and torn down.
45 void Init(const base::FilePath& user_data_directory, 46 void Init(const base::FilePath& user_data_directory,
46 quota::QuotaManagerProxy* quota_manager_proxy); 47 quota::QuotaManagerProxy* quota_manager_proxy);
47 void Shutdown(); 48 void Shutdown();
48 49
49 // The core context is only for use on the IO thread. 50 // The core context is only for use on the IO thread.
50 ServiceWorkerContextCore* context(); 51 ServiceWorkerContextCore* context();
51 52
52 // The process manager can be used on either UI or IO. 53 // The process manager can be used on either UI or IO.
53 ServiceWorkerProcessManager* process_manager() { 54 ServiceWorkerProcessManager* process_manager() {
54 return process_manager_.get(); 55 return process_manager_.get();
55 } 56 }
56 57
58 ServiceWorkerProviderHostRegistry* provider_registry() {
59 return provider_registry_.get();
60 }
61
57 // ServiceWorkerContext implementation: 62 // ServiceWorkerContext implementation:
58 virtual void RegisterServiceWorker( 63 virtual void RegisterServiceWorker(
59 const GURL& pattern, 64 const GURL& pattern,
60 const GURL& script_url, 65 const GURL& script_url,
61 const ResultCallback& continuation) OVERRIDE; 66 const ResultCallback& continuation) OVERRIDE;
62 virtual void UnregisterServiceWorker(const GURL& pattern, 67 virtual void UnregisterServiceWorker(const GURL& pattern,
63 const ResultCallback& continuation) 68 const ResultCallback& continuation)
64 OVERRIDE; 69 OVERRIDE;
65 virtual void Terminate() OVERRIDE; 70 virtual void Terminate() OVERRIDE;
66 71
(...skipping 10 matching lines...) Expand all
77 base::SequencedTaskRunner* database_task_runner, 82 base::SequencedTaskRunner* database_task_runner,
78 base::MessageLoopProxy* disk_cache_thread, 83 base::MessageLoopProxy* disk_cache_thread,
79 quota::QuotaManagerProxy* quota_manager_proxy); 84 quota::QuotaManagerProxy* quota_manager_proxy);
80 void ShutdownOnIO(); 85 void ShutdownOnIO();
81 86
82 const scoped_refptr<ObserverListThreadSafe<ServiceWorkerContextObserver> > 87 const scoped_refptr<ObserverListThreadSafe<ServiceWorkerContextObserver> >
83 observer_list_; 88 observer_list_;
84 const scoped_ptr<ServiceWorkerProcessManager> process_manager_; 89 const scoped_ptr<ServiceWorkerProcessManager> process_manager_;
85 // Cleared in Shutdown(): 90 // Cleared in Shutdown():
86 scoped_ptr<ServiceWorkerContextCore> context_core_; 91 scoped_ptr<ServiceWorkerContextCore> context_core_;
92
93 scoped_ptr<ServiceWorkerProviderHostRegistry> provider_registry_;
87 }; 94 };
88 95
89 } // namespace content 96 } // namespace content
90 97
91 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ 98 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698