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

Side by Side Diff: content/child/service_worker/service_worker_registration_handle_reference.cc

Issue 2118243002: [proof-of-concept] SW thread independent of the main thread Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 3 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/child/service_worker/service_worker_registration_handle_refere nce.h" 5 #include "content/child/service_worker/service_worker_registration_handle_refere nce.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "content/child/thread_safe_sender.h" 8 #include "content/child/thread_safe_sender.h"
9 #include "content/common/service_worker/service_worker_messages.h" 9 #include "content/common/service_worker/service_worker_messages.h"
10 10
(...skipping 19 matching lines...) Expand all
30 ServiceWorkerRegistrationHandleReference( 30 ServiceWorkerRegistrationHandleReference(
31 const ServiceWorkerRegistrationObjectInfo& info, 31 const ServiceWorkerRegistrationObjectInfo& info,
32 ThreadSafeSender* sender, 32 ThreadSafeSender* sender,
33 bool increment_ref_in_ctor) 33 bool increment_ref_in_ctor)
34 : info_(info), 34 : info_(info),
35 sender_(sender) { 35 sender_(sender) {
36 DCHECK_NE(kInvalidServiceWorkerRegistrationHandleId, info_.handle_id); 36 DCHECK_NE(kInvalidServiceWorkerRegistrationHandleId, info_.handle_id);
37 DCHECK(sender_.get()); 37 DCHECK(sender_.get());
38 if (!increment_ref_in_ctor) 38 if (!increment_ref_in_ctor)
39 return; 39 return;
40 if (!sender_)
41 return;
40 sender_->Send( 42 sender_->Send(
41 new ServiceWorkerHostMsg_IncrementRegistrationRefCount(info_.handle_id)); 43 new ServiceWorkerHostMsg_IncrementRegistrationRefCount(info_.handle_id));
42 } 44 }
43 45
44 ServiceWorkerRegistrationHandleReference:: 46 ServiceWorkerRegistrationHandleReference::
45 ~ServiceWorkerRegistrationHandleReference() { 47 ~ServiceWorkerRegistrationHandleReference() {
48 if (!sender_)
49 return;
46 sender_->Send( 50 sender_->Send(
47 new ServiceWorkerHostMsg_DecrementRegistrationRefCount(info_.handle_id)); 51 new ServiceWorkerHostMsg_DecrementRegistrationRefCount(info_.handle_id));
48 } 52 }
49 53
50 } // namespace content 54 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698