OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/worker/websharedworker_stub.h" | 5 #include "content/worker/websharedworker_stub.h" |
6 | 6 |
7 #include "content/common/child_process.h" | 7 #include "content/common/child_process.h" |
8 #include "content/common/child_thread.h" | 8 #include "content/common/child_thread.h" |
9 #include "content/common/file_system/file_system_dispatcher.h" | 9 #include "content/common/file_system/file_system_dispatcher.h" |
10 #include "content/common/webmessageportchannel_impl.h" | 10 #include "content/common/webmessageportchannel_impl.h" |
11 #include "content/common/worker_messages.h" | 11 #include "content/common/worker_messages.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 74 |
75 void WebSharedWorkerStub::OnChannelError() { | 75 void WebSharedWorkerStub::OnChannelError() { |
76 OnTerminateWorkerContext(); | 76 OnTerminateWorkerContext(); |
77 } | 77 } |
78 | 78 |
79 const GURL& WebSharedWorkerStub::url() { | 79 const GURL& WebSharedWorkerStub::url() { |
80 return url_; | 80 return url_; |
81 } | 81 } |
82 | 82 |
83 void WebSharedWorkerStub::OnStartWorkerContext( | 83 void WebSharedWorkerStub::OnStartWorkerContext( |
84 const GURL& url, const string16& user_agent, const string16& source_code, | 84 const GURL& url, const string16& user_agent, const string16& source_code) { |
85 const string16& /* content_security_policy */, bool /* report_only */) { | |
86 // Ignore multiple attempts to start this worker (can happen if two pages | 85 // Ignore multiple attempts to start this worker (can happen if two pages |
87 // try to start it simultaneously). | 86 // try to start it simultaneously). |
88 if (started_) | 87 if (started_) |
89 return; | 88 return; |
90 | 89 |
91 // TODO(tsepez): pass CSP info into worker once webkit interface updated. | |
92 impl_->startWorkerContext(url, name_, user_agent, source_code, 0); | 90 impl_->startWorkerContext(url, name_, user_agent, source_code, 0); |
93 started_ = true; | 91 started_ = true; |
94 url_ = url; | 92 url_ = url; |
95 | 93 |
96 // Process any pending connections. | 94 // Process any pending connections. |
97 for (PendingConnectInfoList::const_iterator iter = pending_connects_.begin(); | 95 for (PendingConnectInfoList::const_iterator iter = pending_connects_.begin(); |
98 iter != pending_connects_.end(); | 96 iter != pending_connects_.end(); |
99 ++iter) { | 97 ++iter) { |
100 OnConnect(iter->first, iter->second); | 98 OnConnect(iter->first, iter->second); |
101 } | 99 } |
(...skipping 15 matching lines...) Expand all Loading... |
117 } | 115 } |
118 } | 116 } |
119 | 117 |
120 void WebSharedWorkerStub::OnTerminateWorkerContext() { | 118 void WebSharedWorkerStub::OnTerminateWorkerContext() { |
121 impl_->terminateWorkerContext(); | 119 impl_->terminateWorkerContext(); |
122 | 120 |
123 // Call the client to make sure context exits. | 121 // Call the client to make sure context exits. |
124 EnsureWorkerContextTerminates(); | 122 EnsureWorkerContextTerminates(); |
125 started_ = false; | 123 started_ = false; |
126 } | 124 } |
OLD | NEW |