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

Side by Side Diff: content/browser/service_worker/service_worker_registration_handle.cc

Issue 508433002: Remove implicit conversions from scoped_refptr to T* in content/browser/service_worker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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
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 #include "content/browser/service_worker/service_worker_registration_handle.h" 5 #include "content/browser/service_worker/service_worker_registration_handle.h"
6 6
7 #include "content/browser/service_worker/service_worker_context_core.h" 7 #include "content/browser/service_worker/service_worker_context_core.h"
8 #include "content/browser/service_worker/service_worker_dispatcher_host.h" 8 #include "content/browser/service_worker/service_worker_dispatcher_host.h"
9 #include "content/browser/service_worker/service_worker_handle.h" 9 #include "content/browser/service_worker/service_worker_handle.h"
10 #include "content/common/service_worker/service_worker_messages.h" 10 #include "content/common/service_worker/service_worker_messages.h"
11 11
12 namespace content { 12 namespace content {
13 13
14 static const int kDocumentMainThreadId = 0; 14 static const int kDocumentMainThreadId = 0;
15 15
16 ServiceWorkerRegistrationHandle::ServiceWorkerRegistrationHandle( 16 ServiceWorkerRegistrationHandle::ServiceWorkerRegistrationHandle(
17 base::WeakPtr<ServiceWorkerContextCore> context, 17 base::WeakPtr<ServiceWorkerContextCore> context,
18 ServiceWorkerDispatcherHost* dispatcher_host, 18 ServiceWorkerDispatcherHost* dispatcher_host,
19 int provider_id, 19 int provider_id,
20 ServiceWorkerRegistration* registration) 20 ServiceWorkerRegistration* registration)
21 : context_(context), 21 : context_(context),
22 dispatcher_host_(dispatcher_host), 22 dispatcher_host_(dispatcher_host),
23 provider_id_(provider_id), 23 provider_id_(provider_id),
24 handle_id_(context ? context->GetNewRegistrationHandleId() 24 handle_id_(context ? context->GetNewRegistrationHandleId()
25 : kInvalidServiceWorkerRegistrationHandleId), 25 : kInvalidServiceWorkerRegistrationHandleId),
26 ref_count_(1), 26 ref_count_(1),
27 registration_(registration) { 27 registration_(registration) {
28 DCHECK(registration_); 28 DCHECK(registration_.get());
29 SetVersionAttributes(registration->installing_version(), 29 SetVersionAttributes(registration->installing_version(),
30 registration->waiting_version(), 30 registration->waiting_version(),
31 registration->active_version()); 31 registration->active_version());
32 registration_->AddListener(this); 32 registration_->AddListener(this);
33 } 33 }
34 34
35 ServiceWorkerRegistrationHandle::~ServiceWorkerRegistrationHandle() { 35 ServiceWorkerRegistrationHandle::~ServiceWorkerRegistrationHandle() {
36 DCHECK(registration_); 36 DCHECK(registration_.get());
37 registration_->RemoveListener(this); 37 registration_->RemoveListener(this);
38 } 38 }
39 39
40 ServiceWorkerRegistrationObjectInfo 40 ServiceWorkerRegistrationObjectInfo
41 ServiceWorkerRegistrationHandle::GetObjectInfo() { 41 ServiceWorkerRegistrationHandle::GetObjectInfo() {
42 ServiceWorkerRegistrationObjectInfo info; 42 ServiceWorkerRegistrationObjectInfo info;
43 info.handle_id = handle_id_; 43 info.handle_id = handle_id_;
44 info.scope = registration_->pattern(); 44 info.scope = registration_->pattern();
45 return info; 45 return info;
46 } 46 }
(...skipping 23 matching lines...) Expand all
70 DCHECK_EQ(registration->id(), registration_->id()); 70 DCHECK_EQ(registration->id(), registration_->id());
71 ClearVersionAttributes(); 71 ClearVersionAttributes();
72 } 72 }
73 73
74 void ServiceWorkerRegistrationHandle::SetVersionAttributes( 74 void ServiceWorkerRegistrationHandle::SetVersionAttributes(
75 ServiceWorkerVersion* installing_version, 75 ServiceWorkerVersion* installing_version,
76 ServiceWorkerVersion* waiting_version, 76 ServiceWorkerVersion* waiting_version,
77 ServiceWorkerVersion* active_version) { 77 ServiceWorkerVersion* active_version) {
78 ChangedVersionAttributesMask mask; 78 ChangedVersionAttributesMask mask;
79 79
80 if (installing_version != installing_version_) { 80 if (installing_version != installing_version_.get()) {
81 installing_version_ = installing_version; 81 installing_version_ = installing_version;
82 mask.add(ChangedVersionAttributesMask::INSTALLING_VERSION); 82 mask.add(ChangedVersionAttributesMask::INSTALLING_VERSION);
83 } 83 }
84 if (waiting_version != waiting_version_) { 84 if (waiting_version != waiting_version_.get()) {
85 waiting_version_ = waiting_version; 85 waiting_version_ = waiting_version;
86 mask.add(ChangedVersionAttributesMask::WAITING_VERSION); 86 mask.add(ChangedVersionAttributesMask::WAITING_VERSION);
87 } 87 }
88 if (active_version != active_version_) { 88 if (active_version != active_version_.get()) {
89 active_version_ = active_version; 89 active_version_ = active_version;
90 mask.add(ChangedVersionAttributesMask::ACTIVE_VERSION); 90 mask.add(ChangedVersionAttributesMask::ACTIVE_VERSION);
91 } 91 }
92 92
93 if (!dispatcher_host_) 93 if (!dispatcher_host_)
94 return; // Could be NULL in some tests. 94 return; // Could be NULL in some tests.
95 if (!mask.changed()) 95 if (!mask.changed())
96 return; 96 return;
97 97
98 ServiceWorkerVersionAttributes attributes; 98 ServiceWorkerVersionAttributes attributes;
(...skipping 30 matching lines...) Expand all
129 kDocumentMainThreadId, 129 kDocumentMainThreadId,
130 provider_id_, 130 provider_id_,
131 version); 131 version);
132 info = handle->GetObjectInfo(); 132 info = handle->GetObjectInfo();
133 dispatcher_host_->RegisterServiceWorkerHandle(handle.Pass()); 133 dispatcher_host_->RegisterServiceWorkerHandle(handle.Pass());
134 } 134 }
135 return info; 135 return info;
136 } 136 }
137 137
138 } // namespace content 138 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698