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

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

Issue 261533003: Populate .current when navigator.serviceWorker is accessed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 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_HANDLE_H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_HANDLE_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_HANDLE_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_HANDLE_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 int line_number, 64 int line_number,
65 const GURL& source_url) OVERRIDE; 65 const GURL& source_url) OVERRIDE;
66 virtual void OnVersionStateChanged(ServiceWorkerVersion* version) OVERRIDE; 66 virtual void OnVersionStateChanged(ServiceWorkerVersion* version) OVERRIDE;
67 67
68 ServiceWorkerObjectInfo GetObjectInfo(); 68 ServiceWorkerObjectInfo GetObjectInfo();
69 69
70 ServiceWorkerRegistration* registration() { return registration_.get(); } 70 ServiceWorkerRegistration* registration() { return registration_.get(); }
71 ServiceWorkerVersion* version() { return version_.get(); } 71 ServiceWorkerVersion* version() { return version_.get(); }
72 int handle_id() const { return handle_id_; } 72 int handle_id() const { return handle_id_; }
73 73
74 bool HasNoRefCount() const { return ref_count_ <= 0; }
75 void IncrementRefCount();
76 void DecrementRefCount();
77
74 private: 78 private:
75 base::WeakPtr<ServiceWorkerContextCore> context_; 79 base::WeakPtr<ServiceWorkerContextCore> context_;
76 IPC::Sender* sender_; // Not owned, it should always outlive this. 80 IPC::Sender* sender_; // Not owned, it should always outlive this.
77 const int thread_id_; 81 const int thread_id_;
78 const int handle_id_; 82 const int handle_id_;
83 int ref_count_; // Created with 1.
79 scoped_refptr<ServiceWorkerRegistration> registration_; 84 scoped_refptr<ServiceWorkerRegistration> registration_;
80 scoped_refptr<ServiceWorkerVersion> version_; 85 scoped_refptr<ServiceWorkerVersion> version_;
81 86
82 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerHandle); 87 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerHandle);
83 }; 88 };
84 89
85 } // namespace content 90 } // namespace content
86 91
87 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_HANDLE_H_ 92 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_HANDLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698