OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/worker/webworker_stub.h" | 5 #include "chrome/worker/webworker_stub.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/common/chrome_switches.h" | 8 #include "chrome/common/chrome_switches.h" |
9 #include "chrome/common/webmessageportchannel_impl.h" | 9 #include "chrome/common/webmessageportchannel_impl.h" |
10 #include "chrome/common/worker_messages.h" | 10 #include "chrome/common/worker_messages.h" |
11 #include "chrome/worker/nativewebworker_impl.h" | 11 #include "chrome/worker/nativewebworker_impl.h" |
12 #include "webkit/api/public/WebString.h" | 12 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" |
13 #include "webkit/api/public/WebURL.h" | 13 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" |
14 #include "webkit/api/public/WebWorker.h" | 14 #include "third_party/WebKit/WebKit/chromium/public/WebWorker.h" |
15 | 15 |
16 using WebKit::WebWorker; | 16 using WebKit::WebWorker; |
17 | 17 |
18 static bool UrlIsNativeWorker(const GURL& url) { | 18 static bool UrlIsNativeWorker(const GURL& url) { |
19 // If the renderer was not passed the switch to enable native workers, | 19 // If the renderer was not passed the switch to enable native workers, |
20 // then the URL should be treated as a JavaScript worker. | 20 // then the URL should be treated as a JavaScript worker. |
21 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 21 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
22 switches::kEnableNativeWebWorkers)) { | 22 switches::kEnableNativeWebWorkers)) { |
23 return false; | 23 return false; |
24 } | 24 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 const std::vector<int>& sent_message_port_ids, | 75 const std::vector<int>& sent_message_port_ids, |
76 const std::vector<int>& new_routing_ids) { | 76 const std::vector<int>& new_routing_ids) { |
77 WebKit::WebMessagePortChannelArray channels(sent_message_port_ids.size()); | 77 WebKit::WebMessagePortChannelArray channels(sent_message_port_ids.size()); |
78 for (size_t i = 0; i < sent_message_port_ids.size(); i++) { | 78 for (size_t i = 0; i < sent_message_port_ids.size(); i++) { |
79 channels[i] = new WebMessagePortChannelImpl( | 79 channels[i] = new WebMessagePortChannelImpl( |
80 new_routing_ids[i], sent_message_port_ids[i]); | 80 new_routing_ids[i], sent_message_port_ids[i]); |
81 } | 81 } |
82 | 82 |
83 impl_->postMessageToWorkerContext(message, channels); | 83 impl_->postMessageToWorkerContext(message, channels); |
84 } | 84 } |
OLD | NEW |