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

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

Issue 463013002: ServiceWorker: Implement updatefound event and version attributes (Chromium) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address for comments 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 | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #include "content/child/service_worker/service_worker_registration_handle_refere nce.h"
6
7 #include "content/child/thread_safe_sender.h"
8 #include "content/common/service_worker/service_worker_messages.h"
9 #include "content/common/service_worker/service_worker_types.h"
10
11 namespace content {
12
13 scoped_ptr<ServiceWorkerRegistrationHandleReference>
14 ServiceWorkerRegistrationHandleReference::Create(
15 int registration_handle_id,
16 const ServiceWorkerObjectInfo& info,
17 ThreadSafeSender* sender) {
18 return make_scoped_ptr(new ServiceWorkerRegistrationHandleReference(
19 registration_handle_id, info, sender, true));
20 }
21
22 scoped_ptr<ServiceWorkerRegistrationHandleReference>
23 ServiceWorkerRegistrationHandleReference::Adopt(
24 int registration_handle_id,
25 const ServiceWorkerObjectInfo& info,
26 ThreadSafeSender* sender) {
27 return make_scoped_ptr(new ServiceWorkerRegistrationHandleReference(
28 registration_handle_id, info, sender, false));
29 }
30
31 ServiceWorkerRegistrationHandleReference::
32 ServiceWorkerRegistrationHandleReference(
33 int registration_handle_id,
34 const ServiceWorkerObjectInfo& info,
35 ThreadSafeSender* sender,
36 bool increment_ref_in_ctor)
37 : handle_id_(registration_handle_id),
38 scope_(info.scope),
39 sender_(sender) {
40 DCHECK_NE(kInvalidServiceWorkerRegistrationHandleId, handle_id_);
41 DCHECK(sender_);
42 if (increment_ref_in_ctor)
43 return;
44 sender_->Send(
45 new ServiceWorkerHostMsg_IncrementRegistrationRefCount(handle_id_));
46 }
47
48 ServiceWorkerRegistrationHandleReference::
49 ~ServiceWorkerRegistrationHandleReference() {
50 sender_->Send(
51 new ServiceWorkerHostMsg_DecrementRegistrationRefCount(handle_id_));
52 }
53
54 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698