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

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

Issue 224733014: Introduce ServiceWorkerHandle for tracking WebServiceWorkerImpl reference (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sigh, rebased Created 6 years, 8 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/browser/service_worker/service_worker_context_core.h"
6 #include "content/browser/service_worker/service_worker_handle.h"
7 #include "content/browser/service_worker/service_worker_registration.h"
8
9 namespace content {
10
11 scoped_ptr<ServiceWorkerHandle> ServiceWorkerHandle::Create(
12 base::WeakPtr<ServiceWorkerContextCore> context,
13 IPC::Sender* sender,
14 int thread_id,
15 ServiceWorkerVersion* version) {
16 if (!context || !version)
17 return scoped_ptr<ServiceWorkerHandle>();
18 ServiceWorkerRegistration* registration =
19 context->GetLiveRegistration(version->registration_id());
20 return make_scoped_ptr(
21 new ServiceWorkerHandle(context, sender, thread_id,
22 registration, version));
23 }
24
25 ServiceWorkerHandle::ServiceWorkerHandle(
26 base::WeakPtr<ServiceWorkerContextCore> context,
27 IPC::Sender* sender,
28 int thread_id,
29 ServiceWorkerRegistration* registration,
30 ServiceWorkerVersion* version)
31 : context_(context),
32 sender_(sender),
33 thread_id_(thread_id),
34 registration_(registration),
35 version_(version) {
36 }
37
38 ServiceWorkerHandle::~ServiceWorkerHandle() {
39 // TODO(kinuko): At this point we can discard the registration if
40 // all documents/handles that have a reference to the registration is
41 // closed or freed up, but could also keep it alive in cache
42 // (e.g. in context_) for a while with some timer so that we don't
43 // need to re-load the same registration from disk over and over.
44 }
45
46 void ServiceWorkerHandle::OnVersionStateChanged(ServiceWorkerVersion* version) {
47 // TODO(kinuko): Implement.
48 }
49
50 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/service_worker/service_worker_handle.h ('k') | content/browser/service_worker/service_worker_job_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698