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
3 // found in the LICENSE file.
5 #include "content/child/service_worker/service_worker_handle_reference.h"
7 #include "content/child/thread_safe_sender.h"
8 #include "content/common/service_worker/service_worker_messages.h"
12 scoped_ptr
<ServiceWorkerHandleReference
>
13 ServiceWorkerHandleReference::Create(
14 const ServiceWorkerObjectInfo
& info
,
15 ThreadSafeSender
* sender
) {
17 return make_scoped_ptr(new ServiceWorkerHandleReference(info
, sender
, true));
20 scoped_ptr
<ServiceWorkerHandleReference
> ServiceWorkerHandleReference::Adopt(
21 const ServiceWorkerObjectInfo
& info
,
22 ThreadSafeSender
* sender
) {
24 return make_scoped_ptr(new ServiceWorkerHandleReference(info
, sender
, false));
27 ServiceWorkerHandleReference::ServiceWorkerHandleReference(
28 const ServiceWorkerObjectInfo
& info
,
29 ThreadSafeSender
* sender
,
30 bool increment_ref_in_ctor
)
33 if (increment_ref_in_ctor
&&
34 info_
.handle_id
!= kInvalidServiceWorkerHandleId
) {
36 new ServiceWorkerHostMsg_IncrementServiceWorkerRefCount(
41 ServiceWorkerHandleReference::~ServiceWorkerHandleReference() {
42 if (info_
.handle_id
!= kInvalidServiceWorkerHandleId
) {
44 new ServiceWorkerHostMsg_DecrementServiceWorkerRefCount(
49 } // namespace content