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

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: 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> {
michaeln 2013/11/11 23:48:24 Is there a reason to make this a thread-safe? I th
23 public:
24 ServiceWorkerRegistration(const GURL& pattern,
michaeln 2013/11/11 23:48:24 other places we use the term 'scope', here it's 'p
25 const GURL& script_url,
26 int32 service_worker_id);
michaeln 2013/11/11 23:48:24 registration_id this arg s/b called registration_i
27
28 int32 id() const { return registration_id_; }
kinuko 2013/11/08 09:08:21 We're using int64 in other files
alecflett 2013/11/08 22:50:54 Done.
29
30 void Shutdown();
31
32 ServiceWorkerVersion* active_version() {
33 DCHECK(!is_shutdown_);
34 return active_version_.get();
35 }
36 ServiceWorkerVersion* in_waiting_version() {
37 return in_waiting_version_.get();
38 }
39
40 void set_active_version(ServiceWorkerVersion* version) {
41 DCHECK(!is_shutdown_);
42 active_version_.reset(version);
43 }
44 void set_in_waiting_version(ServiceWorkerVersion* version) {
45 DCHECK(!is_shutdown_);
46 in_waiting_version_.reset(version);
47 }
48
49 private:
50 virtual ~ServiceWorkerRegistration();
51 friend class base::RefCountedThreadSafe<ServiceWorkerRegistration>;
52
53 const GURL& pattern_;
54 const GURL& script_url_;
55 const int32 registration_id_;
56
57 scoped_ptr<ServiceWorkerVersion> active_version_;
58 scoped_ptr<ServiceWorkerVersion> in_waiting_version_;
59
60 bool is_shutdown_;
61
62 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistration);
63 };
64 }
65 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698