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

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

Issue 633873002: Service Worker: Respect the "clear on exit" content setting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@contentsettings
Patch Set: just clear in dtor Created 6 years, 2 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
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"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "content/browser/service_worker/service_worker_context_core.h" 13 #include "content/browser/service_worker/service_worker_context_core.h"
14 #include "content/common/content_export.h" 14 #include "content/common/content_export.h"
15 #include "content/public/browser/service_worker_context.h" 15 #include "content/public/browser/service_worker_context.h"
16 16
17 namespace base { 17 namespace base {
18 class FilePath; 18 class FilePath;
19 class SequencedTaskRunner; 19 class SequencedTaskRunner;
20 class SingleThreadTaskRunner; 20 class SingleThreadTaskRunner;
21 } 21 }
22 22
23 namespace net { 23 namespace net {
24 class URLRequestContextGetter; 24 class URLRequestContextGetter;
25 } 25 }
26 26
27 namespace storage { 27 namespace storage {
28 class QuotaManagerProxy; 28 class QuotaManagerProxy;
29 class SpecialStoragePolicy;
29 } 30 }
30 31
31 namespace content { 32 namespace content {
32 33
33 class BrowserContext; 34 class BrowserContext;
34 class ChromeBlobStorageContext; 35 class ChromeBlobStorageContext;
35 class ServiceWorkerContextCore; 36 class ServiceWorkerContextCore;
36 class ServiceWorkerContextObserver; 37 class ServiceWorkerContextObserver;
37 38
38 // A refcounted wrapper class for our core object. Higher level content lib 39 // A refcounted wrapper class for our core object. Higher level content lib
39 // classes keep references to this class on mutliple threads. The inner core 40 // classes keep references to this class on mutliple threads. The inner core
40 // instance is strictly single threaded and is not refcounted, the core object 41 // instance is strictly single threaded and is not refcounted, the core object
41 // is what is used internally in the service worker lib. 42 // is what is used internally in the service worker lib.
42 class CONTENT_EXPORT ServiceWorkerContextWrapper 43 class CONTENT_EXPORT ServiceWorkerContextWrapper
43 : NON_EXPORTED_BASE(public ServiceWorkerContext), 44 : NON_EXPORTED_BASE(public ServiceWorkerContext),
44 public base::RefCountedThreadSafe<ServiceWorkerContextWrapper> { 45 public base::RefCountedThreadSafe<ServiceWorkerContextWrapper> {
45 public: 46 public:
46 ServiceWorkerContextWrapper(BrowserContext* browser_context); 47 ServiceWorkerContextWrapper(BrowserContext* browser_context);
47 48
48 // Init and Shutdown are for use on the UI thread when the profile, 49 // Init and Shutdown are for use on the UI thread when the profile,
49 // storagepartition is being setup and torn down. 50 // storagepartition is being setup and torn down.
50 void Init(const base::FilePath& user_data_directory, 51 void Init(const base::FilePath& user_data_directory,
51 storage::QuotaManagerProxy* quota_manager_proxy); 52 storage::QuotaManagerProxy* quota_manager_proxy,
53 storage::SpecialStoragePolicy* special_storage_policy);
52 void Shutdown(); 54 void Shutdown();
53 55
54 // Deletes all files on disk and restarts the system asynchronously. This 56 // Deletes all files on disk and restarts the system asynchronously. This
55 // leaves the system in a disabled state until it's done. This should be 57 // leaves the system in a disabled state until it's done. This should be
56 // called on the IO thread. 58 // called on the IO thread.
57 void DeleteAndStartOver(); 59 void DeleteAndStartOver();
58 60
59 // The core context is only for use on the IO thread. 61 // The core context is only for use on the IO thread.
60 ServiceWorkerContextCore* context(); 62 ServiceWorkerContextCore* context();
61 63
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 friend class base::RefCountedThreadSafe<ServiceWorkerContextWrapper>; 97 friend class base::RefCountedThreadSafe<ServiceWorkerContextWrapper>;
96 friend class EmbeddedWorkerTestHelper; 98 friend class EmbeddedWorkerTestHelper;
97 friend class ServiceWorkerProcessManager; 99 friend class ServiceWorkerProcessManager;
98 virtual ~ServiceWorkerContextWrapper(); 100 virtual ~ServiceWorkerContextWrapper();
99 101
100 void InitInternal( 102 void InitInternal(
101 const base::FilePath& user_data_directory, 103 const base::FilePath& user_data_directory,
102 const scoped_refptr<base::SequencedTaskRunner>& stores_task_runner, 104 const scoped_refptr<base::SequencedTaskRunner>& stores_task_runner,
103 const scoped_refptr<base::SequencedTaskRunner>& database_task_runner, 105 const scoped_refptr<base::SequencedTaskRunner>& database_task_runner,
104 const scoped_refptr<base::SingleThreadTaskRunner>& disk_cache_thread, 106 const scoped_refptr<base::SingleThreadTaskRunner>& disk_cache_thread,
105 storage::QuotaManagerProxy* quota_manager_proxy); 107 storage::QuotaManagerProxy* quota_manager_proxy,
108 storage::SpecialStoragePolicy* special_storage_policy);
106 void ShutdownOnIO(); 109 void ShutdownOnIO();
107 110
108 void DidDeleteAndStartOver(ServiceWorkerStatusCode status); 111 void DidDeleteAndStartOver(ServiceWorkerStatusCode status);
109 112
110 void DidGetAllRegistrationsForGetAllOrigins( 113 void DidGetAllRegistrationsForGetAllOrigins(
111 const GetUsageInfoCallback& callback, 114 const GetUsageInfoCallback& callback,
112 const std::vector<ServiceWorkerRegistrationInfo>& registrations); 115 const std::vector<ServiceWorkerRegistrationInfo>& registrations);
113 void DidGetAllRegistrationsForDeleteForOrigin( 116 void DidGetAllRegistrationsForDeleteForOrigin(
114 const GURL& origin, 117 const GURL& origin,
115 const std::vector<ServiceWorkerRegistrationInfo>& registrations); 118 const std::vector<ServiceWorkerRegistrationInfo>& registrations);
116 119
117 const scoped_refptr<ObserverListThreadSafe<ServiceWorkerContextObserver> > 120 const scoped_refptr<ObserverListThreadSafe<ServiceWorkerContextObserver> >
118 observer_list_; 121 observer_list_;
119 const scoped_ptr<ServiceWorkerProcessManager> process_manager_; 122 const scoped_ptr<ServiceWorkerProcessManager> process_manager_;
120 // Cleared in Shutdown(): 123 // Cleared in Shutdown():
121 scoped_ptr<ServiceWorkerContextCore> context_core_; 124 scoped_ptr<ServiceWorkerContextCore> context_core_;
122 125
123 // Initialized in Init(); true of the user data directory is empty. 126 // Initialized in Init(); true if the user data directory is empty.
124 bool is_incognito_; 127 bool is_incognito_;
125 }; 128 };
126 129
127 } // namespace content 130 } // namespace content
128 131
129 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ 132 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698