OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "content/child/child_process.h" | 8 #include "content/child/child_process.h" |
9 #include "content/child/child_thread.h" | 9 #include "content/child/child_thread.h" |
10 #include "content/child/fileapi/file_system_dispatcher.h" | 10 #include "content/child/fileapi/file_system_dispatcher.h" |
11 #include "content/child/webmessageportchannel_impl.h" | 11 #include "content/child/webmessageportchannel_impl.h" |
12 #include "content/common/worker_messages.h" | 12 #include "content/common/worker_messages.h" |
13 #include "content/worker/shared_worker_devtools_agent.h" | 13 #include "content/worker/shared_worker_devtools_agent.h" |
14 #include "content/worker/worker_thread.h" | 14 #include "content/worker/worker_thread.h" |
15 #include "third_party/WebKit/public/web/WebSharedWorker.h" | 15 #include "third_party/WebKit/public/web/WebSharedWorker.h" |
16 #include "third_party/WebKit/public/platform/WebString.h" | 16 #include "third_party/WebKit/public/platform/WebString.h" |
17 #include "third_party/WebKit/public/platform/WebURL.h" | 17 #include "third_party/WebKit/public/platform/WebURL.h" |
18 | 18 |
19 namespace content { | 19 namespace content { |
20 | 20 |
21 WebSharedWorkerStub::WebSharedWorkerStub( | 21 WebSharedWorkerStub::WebSharedWorkerStub( |
22 const string16& name, | 22 const base::string16& name, |
23 int route_id, | 23 int route_id, |
24 const WorkerAppCacheInitInfo& appcache_init_info) | 24 const WorkerAppCacheInitInfo& appcache_init_info) |
25 : route_id_(route_id), | 25 : route_id_(route_id), |
26 appcache_init_info_(appcache_init_info), | 26 appcache_init_info_(appcache_init_info), |
27 client_(route_id, this), | 27 client_(route_id, this), |
28 name_(name), | 28 name_(name), |
29 started_(false) { | 29 started_(false) { |
30 | 30 |
31 WorkerThread* worker_thread = WorkerThread::current(); | 31 WorkerThread* worker_thread = WorkerThread::current(); |
32 DCHECK(worker_thread); | 32 DCHECK(worker_thread); |
(...skipping 41 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 base::string16& user_agent, |
85 const string16& content_security_policy, | 85 const base::string16& source_code, |
| 86 const base::string16& content_security_policy, |
86 blink::WebContentSecurityPolicyType policy_type) { | 87 blink::WebContentSecurityPolicyType policy_type) { |
87 // Ignore multiple attempts to start this worker (can happen if two pages | 88 // Ignore multiple attempts to start this worker (can happen if two pages |
88 // try to start it simultaneously). | 89 // try to start it simultaneously). |
89 if (started_) | 90 if (started_) |
90 return; | 91 return; |
91 | 92 |
92 impl_->startWorkerContext(url, name_, user_agent, source_code, | 93 impl_->startWorkerContext(url, name_, user_agent, source_code, |
93 content_security_policy, policy_type, 0); | 94 content_security_policy, policy_type, 0); |
94 started_ = true; | 95 started_ = true; |
95 url_ = url; | 96 url_ = url; |
(...skipping 26 matching lines...) Expand all Loading... |
122 | 123 |
123 void WebSharedWorkerStub::OnTerminateWorkerContext() { | 124 void WebSharedWorkerStub::OnTerminateWorkerContext() { |
124 impl_->terminateWorkerContext(); | 125 impl_->terminateWorkerContext(); |
125 | 126 |
126 // Call the client to make sure context exits. | 127 // Call the client to make sure context exits. |
127 EnsureWorkerContextTerminates(); | 128 EnsureWorkerContextTerminates(); |
128 started_ = false; | 129 started_ = false; |
129 } | 130 } |
130 | 131 |
131 } // namespace content | 132 } // namespace content |
OLD | NEW |