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

Side by Side Diff: content/browser/shared_worker/shared_worker_host.cc

Issue 177043003: Implement SharedWorkerServiceImpl::CreateWorker and SharedWorkerInstance and SharedWorkerHost (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 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 2013 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.h" 5 #include "content/browser/shared_worker/shared_worker_host.h"
6 6
7 #include "content/browser/shared_worker/shared_worker_instance.h"
8 #include "content/browser/shared_worker/shared_worker_message_filter.h"
7 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
8 10
9 namespace content { 11 namespace content {
10 12
11 ServiceWorkerRegistration::ServiceWorkerRegistration(const GURL& pattern, 13 SharedWorkerHost::SharedWorkerHost(SharedWorkerInstance* instance)
12 const GURL& script_url, 14 : instance_(instance),
13 int64 registration_id) 15 worker_route_id_(MSG_ROUTING_NONE) {
14 : pattern_(pattern),
15 script_url_(script_url),
16 registration_id_(registration_id),
17 next_version_id_(0L),
18 is_shutdown_(false) {
19 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 16 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
20 } 17 }
21 18
22 ServiceWorkerRegistration::~ServiceWorkerRegistration() { 19 SharedWorkerHost::~SharedWorkerHost() {
23 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 20 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
24 DCHECK(is_shutdown_);
25 } 21 }
26 22
27 void ServiceWorkerRegistration::Shutdown() { 23 bool SharedWorkerHost::Init(SharedWorkerMessageFilter* filter) {
28 DCHECK(!is_shutdown_); 24 DCHECK(worker_route_id_ == MSG_ROUTING_NONE);
29 if (active_version_) 25 worker_route_id_ = filter->GetNextRoutingID();
30 active_version_->Shutdown(); 26 // TODO(horo): implement this.
31 active_version_ = NULL; 27 NOTIMPLEMENTED();
32 if (pending_version_) 28 return false;
33 pending_version_->Shutdown();
34 pending_version_ = NULL;
35 is_shutdown_ = true;
36 }
37
38 void ServiceWorkerRegistration::ActivatePendingVersion() {
39 active_version_->Shutdown();
40 active_version_ = pending_version_;
41 pending_version_ = NULL;
42 } 29 }
43 30
44 } // namespace content 31 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698