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

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

Issue 178343011: Support dispatching ServiceWorker FetchEvent and receiving response (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use const for result on failure Created 6 years, 9 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_VERSION_H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "base/id_map.h" 13 #include "base/id_map.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "content/browser/service_worker/embedded_worker_instance.h" 16 #include "content/browser/service_worker/embedded_worker_instance.h"
17 #include "content/common/content_export.h" 17 #include "content/common/content_export.h"
18 #include "content/common/service_worker/service_worker_status_code.h" 18 #include "content/common/service_worker/service_worker_status_code.h"
19 #include "content/common/service_worker/service_worker_types.h"
19 20
20 class GURL; 21 class GURL;
21 22
22 namespace content { 23 namespace content {
23 24
24 class EmbeddedWorkerRegistry; 25 class EmbeddedWorkerRegistry;
25 class ServiceWorkerRegistration; 26 class ServiceWorkerRegistration;
26 struct ServiceWorkerFetchRequest;
27 struct ServiceWorkerFetchResponse;
28 27
29 // This class corresponds to a specific version of a ServiceWorker 28 // This class corresponds to a specific version of a ServiceWorker
30 // script for a given pattern. When a script is upgraded, there may be 29 // script for a given pattern. When a script is upgraded, there may be
31 // more than one ServiceWorkerVersion "running" at a time, but only 30 // more than one ServiceWorkerVersion "running" at a time, but only
32 // one of them is active. This class connects the actual script with a 31 // one of them is active. This class connects the actual script with a
33 // running worker. 32 // running worker.
34 // Instances of this class are in one of two install states: 33 // Instances of this class are in one of two install states:
35 // - Pending: The script is in the process of being installed. There 34 // - Pending: The script is in the process of being installed. There
36 // may be another active script running. 35 // may be another active script running.
37 // - Active: The script is the only worker handling requests for the 36 // - Active: The script is the only worker handling requests for the
(...skipping 21 matching lines...) Expand all
59 // being deleted from memory. This happens when a version is replaced 58 // being deleted from memory. This happens when a version is replaced
60 // as well as at browser shutdown. 59 // as well as at browser shutdown.
61 class CONTENT_EXPORT ServiceWorkerVersion 60 class CONTENT_EXPORT ServiceWorkerVersion
62 : NON_EXPORTED_BASE(public base::RefCounted<ServiceWorkerVersion>), 61 : NON_EXPORTED_BASE(public base::RefCounted<ServiceWorkerVersion>),
63 public EmbeddedWorkerInstance::Observer { 62 public EmbeddedWorkerInstance::Observer {
64 public: 63 public:
65 typedef base::Callback<void(ServiceWorkerStatusCode)> StatusCallback; 64 typedef base::Callback<void(ServiceWorkerStatusCode)> StatusCallback;
66 typedef base::Callback<void(ServiceWorkerStatusCode, 65 typedef base::Callback<void(ServiceWorkerStatusCode,
67 const IPC::Message& message)> MessageCallback; 66 const IPC::Message& message)> MessageCallback;
68 typedef base::Callback<void(ServiceWorkerStatusCode, 67 typedef base::Callback<void(ServiceWorkerStatusCode,
69 const ServiceWorkerFetchResponse& response)> 68 ServiceWorkerFetchEventResult,
70 FetchCallback; 69 const ServiceWorkerResponse&)> FetchCallback;
71 70
72 enum Status { 71 enum Status {
73 STOPPED = EmbeddedWorkerInstance::STOPPED, 72 STOPPED = EmbeddedWorkerInstance::STOPPED,
74 STARTING = EmbeddedWorkerInstance::STARTING, 73 STARTING = EmbeddedWorkerInstance::STARTING,
75 RUNNING = EmbeddedWorkerInstance::RUNNING, 74 RUNNING = EmbeddedWorkerInstance::RUNNING,
76 STOPPING = EmbeddedWorkerInstance::STOPPING, 75 STOPPING = EmbeddedWorkerInstance::STOPPING,
77 }; 76 };
78 77
79 ServiceWorkerVersion( 78 ServiceWorkerVersion(
80 ServiceWorkerRegistration* registration, 79 ServiceWorkerRegistration* registration,
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 IDMap<MessageCallback, IDMapOwnPointer> message_callbacks_; 161 IDMap<MessageCallback, IDMapOwnPointer> message_callbacks_;
163 162
164 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; 163 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_;
165 164
166 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); 165 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion);
167 }; 166 };
168 167
169 } // namespace content 168 } // namespace content
170 169
171 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ 170 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_
OLDNEW
« no previous file with comments | « content/browser/service_worker/service_worker_browsertest.cc ('k') | content/browser/service_worker/service_worker_version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698