| OLD | NEW |
| 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 <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 int64 version_id() const { return version_id_; } | 102 int64 version_id() const { return version_id_; } |
| 103 int64 registration_id() const { return registration_id_; } | 103 int64 registration_id() const { return registration_id_; } |
| 104 const GURL& script_url() const { return script_url_; } | 104 const GURL& script_url() const { return script_url_; } |
| 105 const GURL& scope() const { return scope_; } | 105 const GURL& scope() const { return scope_; } |
| 106 RunningStatus running_status() const { | 106 RunningStatus running_status() const { |
| 107 return static_cast<RunningStatus>(embedded_worker_->status()); | 107 return static_cast<RunningStatus>(embedded_worker_->status()); |
| 108 } | 108 } |
| 109 ServiceWorkerVersionInfo GetInfo(); | 109 ServiceWorkerVersionInfo GetInfo(); |
| 110 Status status() const { return status_; } | 110 Status status() const { return status_; } |
| 111 | 111 |
| 112 size_t resources_total_size_bytes() const { |
| 113 return resources_total_size_bytes_; |
| 114 } |
| 115 // Should only be called by ServiceWorkerStorage::StoreRegistration |
| 116 void set_resources_total_size_bytes(size_t resources_total_size_bytes) { |
| 117 resources_total_size_bytes_ = resources_total_size_bytes; |
| 118 } |
| 119 |
| 112 // This sets the new status and also run status change callbacks | 120 // This sets the new status and also run status change callbacks |
| 113 // if there're any (see RegisterStatusChangeCallback). | 121 // if there're any (see RegisterStatusChangeCallback). |
| 114 void SetStatus(Status status); | 122 void SetStatus(Status status); |
| 115 | 123 |
| 116 // Registers status change callback. (This is for one-off observation, | 124 // Registers status change callback. (This is for one-off observation, |
| 117 // the consumer needs to re-register if it wants to continue observing | 125 // the consumer needs to re-register if it wants to continue observing |
| 118 // status changes) | 126 // status changes) |
| 119 void RegisterStatusChangeCallback(const base::Closure& callback); | 127 void RegisterStatusChangeCallback(const base::Closure& callback); |
| 120 | 128 |
| 121 // Starts an embedded worker for this version. | 129 // Starts an embedded worker for this version. |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 const std::vector<int>& sent_message_port_ids); | 275 const std::vector<int>& sent_message_port_ids); |
| 268 | 276 |
| 269 void ScheduleStopWorker(); | 277 void ScheduleStopWorker(); |
| 270 void DoomInternal(); | 278 void DoomInternal(); |
| 271 | 279 |
| 272 const int64 version_id_; | 280 const int64 version_id_; |
| 273 int64 registration_id_; | 281 int64 registration_id_; |
| 274 GURL script_url_; | 282 GURL script_url_; |
| 275 GURL scope_; | 283 GURL scope_; |
| 276 Status status_; | 284 Status status_; |
| 285 size_t resources_total_size_bytes_; |
| 277 scoped_ptr<EmbeddedWorkerInstance> embedded_worker_; | 286 scoped_ptr<EmbeddedWorkerInstance> embedded_worker_; |
| 278 scoped_ptr<ServiceWorkerCacheListener> cache_listener_; | 287 scoped_ptr<ServiceWorkerCacheListener> cache_listener_; |
| 279 std::vector<StatusCallback> start_callbacks_; | 288 std::vector<StatusCallback> start_callbacks_; |
| 280 std::vector<StatusCallback> stop_callbacks_; | 289 std::vector<StatusCallback> stop_callbacks_; |
| 281 std::vector<base::Closure> status_change_callbacks_; | 290 std::vector<base::Closure> status_change_callbacks_; |
| 282 | 291 |
| 283 // Message callbacks. | 292 // Message callbacks. |
| 284 IDMap<StatusCallback, IDMapOwnPointer> activate_callbacks_; | 293 IDMap<StatusCallback, IDMapOwnPointer> activate_callbacks_; |
| 285 IDMap<StatusCallback, IDMapOwnPointer> install_callbacks_; | 294 IDMap<StatusCallback, IDMapOwnPointer> install_callbacks_; |
| 286 IDMap<FetchCallback, IDMapOwnPointer> fetch_callbacks_; | 295 IDMap<FetchCallback, IDMapOwnPointer> fetch_callbacks_; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 297 bool is_doomed_; | 306 bool is_doomed_; |
| 298 | 307 |
| 299 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; | 308 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; |
| 300 | 309 |
| 301 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); | 310 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); |
| 302 }; | 311 }; |
| 303 | 312 |
| 304 } // namespace content | 313 } // namespace content |
| 305 | 314 |
| 306 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 315 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
| OLD | NEW |