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

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

Issue 411973004: Stitch CacheStorage messages to implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cache_storage_stitch
Patch Set: nits Created 6 years, 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_STORES_LISTENER_H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CACHE_LISTENER_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORES_LISTENER_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CACHE_LISTENER_H_
7 7
8 #include "base/memory/weak_ptr.h"
8 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
9 #include "content/browser/service_worker/embedded_worker_instance.h" 10 #include "content/browser/service_worker/embedded_worker_instance.h"
11 #include "content/browser/service_worker/service_worker_cache_storage.h"
10 12
11 namespace content { 13 namespace content {
12 14
13 class ServiceWorkerVersion; 15 class ServiceWorkerVersion;
14 16
15 // This class listens for requests on the Store APIs, and sends response 17 // This class listens for requests on the Cache APIs, and sends response
16 // messages to the renderer process. There is one instance per 18 // messages to the renderer process. There is one instance per
17 // ServiceWorkerVersion instance. 19 // ServiceWorkerVersion instance.
18 class ServiceWorkerStoresListener : public EmbeddedWorkerInstance::Listener { 20 class ServiceWorkerCacheListener : public EmbeddedWorkerInstance::Listener {
19 public: 21 public:
20 explicit ServiceWorkerStoresListener(ServiceWorkerVersion* version); 22 ServiceWorkerCacheListener(ServiceWorkerVersion* version,
21 virtual ~ServiceWorkerStoresListener(); 23 base::WeakPtr<ServiceWorkerContextCore> context);
24 virtual ~ServiceWorkerCacheListener();
22 25
23 // From EmbeddedWorkerInstance::Listener: 26 // From EmbeddedWorkerInstance::Listener:
24 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 27 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
25 28
26 // Message receiver functions for CacheStorage API. 29 // Message receiver functions for CacheStorage API.
27 void OnCacheStorageGet(int request_id, const base::string16& cache_name); 30 void OnCacheStorageGet(int request_id, const base::string16& cache_name);
28 void OnCacheStorageHas(int request_id, const base::string16& cache_name); 31 void OnCacheStorageHas(int request_id, const base::string16& cache_name);
29 void OnCacheStorageCreate(int request_id, 32 void OnCacheStorageCreate(int request_id,
30 const base::string16& cache_name); 33 const base::string16& cache_name);
31 void OnCacheStorageDelete(int request_id, 34 void OnCacheStorageDelete(int request_id,
32 const base::string16& cache_name); 35 const base::string16& cache_name);
33 void OnCacheStorageKeys(int request_id); 36 void OnCacheStorageKeys(int request_id);
34 37
35 private: 38 private:
36 void Send(const IPC::Message& message); 39 void Send(const IPC::Message& message);
37 40
41 void OnCacheStorageGetCallback(
michaeln 2014/08/12 03:59:23 i like the method naming!
jkarlin 2014/08/12 15:17:48 Thanks :)
42 int request_id,
43 int cache_id,
44 ServiceWorkerCacheStorage::CacheStorageError error);
45 void OnCacheStorageHasCallback(
46 int request_id,
47 bool has_cache,
48 ServiceWorkerCacheStorage::CacheStorageError error);
49 void OnCacheStorageCreateCallback(
50 int request_id,
51 int cache_id,
52 ServiceWorkerCacheStorage::CacheStorageError error);
53 void OnCacheStorageDeleteCallback(
54 int request_id,
55 bool deleted,
56 ServiceWorkerCacheStorage::CacheStorageError error);
57 void OnCacheStorageKeysCallback(
58 int request_id,
59 const std::vector<std::string>& strings,
60 ServiceWorkerCacheStorage::CacheStorageError error);
61
38 // The ServiceWorkerVersion to use for messaging back to the renderer thread. 62 // The ServiceWorkerVersion to use for messaging back to the renderer thread.
39 ServiceWorkerVersion* version_; 63 ServiceWorkerVersion* version_;
64
65 // The ServiceWorkerContextCore should always outlive this.
66 base::WeakPtr<ServiceWorkerContextCore> context_;
67
68 base::WeakPtrFactory<ServiceWorkerCacheListener> weak_factory_;
69
70 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerCacheListener);
40 }; 71 };
41 72
42 } // namespace content 73 } // namespace content
43 74
44 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORES_LISTENER_H_ 75 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CACHE_LISTENER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698