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

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

Issue 1325143004: ServiceWorker: Drop statechange events if WebServiceWorkerProxy is not ready (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/web_service_worker_impl.h" 5 #include "content/child/service_worker/web_service_worker_impl.h"
6 6
7 #include "content/child/service_worker/service_worker_dispatcher.h" 7 #include "content/child/service_worker/service_worker_dispatcher.h"
8 #include "content/child/service_worker/service_worker_handle_reference.h" 8 #include "content/child/service_worker/service_worker_handle_reference.h"
9 #include "content/child/thread_safe_sender.h" 9 #include "content/child/thread_safe_sender.h"
10 #include "content/child/webmessageportchannel_impl.h" 10 #include "content/child/webmessageportchannel_impl.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 return; 51 return;
52 ServiceWorkerDispatcher* dispatcher = 52 ServiceWorkerDispatcher* dispatcher =
53 ServiceWorkerDispatcher::GetThreadSpecificInstance(); 53 ServiceWorkerDispatcher::GetThreadSpecificInstance();
54 if (dispatcher) 54 if (dispatcher)
55 dispatcher->RemoveServiceWorker(handle_ref_->handle_id()); 55 dispatcher->RemoveServiceWorker(handle_ref_->handle_id());
56 } 56 }
57 57
58 void WebServiceWorkerImpl::OnStateChanged( 58 void WebServiceWorkerImpl::OnStateChanged(
59 blink::WebServiceWorkerState new_state) { 59 blink::WebServiceWorkerState new_state) {
60 state_ = new_state; 60 state_ = new_state;
61 proxy_->dispatchStateChangeEvent(); 61
62 // TODO(nhiroki): This is a quick fix for http://crbug.com/507110
63 DCHECK(proxy_);
64 if (proxy_)
65 proxy_->dispatchStateChangeEvent();
62 } 66 }
63 67
64 void WebServiceWorkerImpl::setProxy(blink::WebServiceWorkerProxy* proxy) { 68 void WebServiceWorkerImpl::setProxy(blink::WebServiceWorkerProxy* proxy) {
65 proxy_ = proxy; 69 proxy_ = proxy;
66 } 70 }
67 71
68 blink::WebServiceWorkerProxy* WebServiceWorkerImpl::proxy() { 72 blink::WebServiceWorkerProxy* WebServiceWorkerImpl::proxy() {
69 return proxy_; 73 return proxy_;
70 } 74 }
71 75
(...skipping 23 matching lines...) Expand all
95 static_cast<base::string16>(message), 99 static_cast<base::string16>(message),
96 base::Passed(make_scoped_ptr(channels)))); 100 base::Passed(make_scoped_ptr(channels))));
97 } 101 }
98 102
99 void WebServiceWorkerImpl::terminate() { 103 void WebServiceWorkerImpl::terminate() {
100 thread_safe_sender_->Send( 104 thread_safe_sender_->Send(
101 new ServiceWorkerHostMsg_TerminateWorker(handle_ref_->handle_id())); 105 new ServiceWorkerHostMsg_TerminateWorker(handle_ref_->handle_id()));
102 } 106 }
103 107
104 } // namespace content 108 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698