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

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

Issue 62203007: Implement memory-persistent registration (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove some stray #includes Created 7 years, 1 month 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
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_
7
8 #include "base/basictypes.h"
9 #include "base/logging.h"
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "content/browser/service_worker/service_worker_version.h"
13
14 class GURL;
15
16 namespace content {
17
18 class ServiceWorkerVersion;
19
20 // This class acts as a persistent instance
21 class ServiceWorkerRegistration
22 : public base::RefCountedThreadSafe<ServiceWorkerRegistration> {
23 public:
24 ServiceWorkerRegistration(const GURL& pattern,
25 const GURL& script_url,
26 int64 service_worker_id);
27
28 int64 id() const { return registration_id_; }
29
30 void Shutdown();
31
32 const GURL& script_url() const { return script_url_; }
33
34 ServiceWorkerVersion* active_version() const {
35 DCHECK(!is_shutdown_);
36 return active_version_.get();
37 }
38 ServiceWorkerVersion* in_waiting_version() const {
39 return in_waiting_version_.get();
40 }
41
42 void set_active_version(ServiceWorkerVersion* version) {
43 DCHECK(!is_shutdown_);
44 active_version_.reset(version);
45 }
46 void set_in_waiting_version(ServiceWorkerVersion* version) {
47 DCHECK(!is_shutdown_);
48 in_waiting_version_.reset(version);
49 }
50
51 private:
52 virtual ~ServiceWorkerRegistration();
53 friend class base::RefCountedThreadSafe<ServiceWorkerRegistration>;
54
55 const GURL& pattern_;
56 const GURL& script_url_;
57 const int64 registration_id_;
58
59 scoped_ptr<ServiceWorkerVersion> active_version_;
60 scoped_ptr<ServiceWorkerVersion> in_waiting_version_;
61
62 bool is_shutdown_;
63
64 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistration);
65 };
66 } // namespace content
67 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698