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

Side by Side Diff: chrome/worker/webworker_stub.cc

Issue 1719007: Initializing an appcache host in a worker process. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « chrome/worker/webworker_stub.h ('k') | chrome/worker/webworker_stub_base.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
(...skipping 15 matching lines...) Expand all
26 // a NativeWebWorker (for .nexe) or a WebWorker (for anything else). 26 // a NativeWebWorker (for .nexe) or a WebWorker (for anything else).
27 const std::string kNativeSuffix(".nexe"); 27 const std::string kNativeSuffix(".nexe");
28 std::string worker_url = url.path(); 28 std::string worker_url = url.path();
29 // Compute the start index of the suffix. 29 // Compute the start index of the suffix.
30 std::string::size_type suffix_index = 30 std::string::size_type suffix_index =
31 worker_url.length() - kNativeSuffix.length(); 31 worker_url.length() - kNativeSuffix.length();
32 std::string::size_type pos = worker_url.find(kNativeSuffix, suffix_index); 32 std::string::size_type pos = worker_url.find(kNativeSuffix, suffix_index);
33 return (suffix_index == pos); 33 return (suffix_index == pos);
34 } 34 }
35 35
36 WebWorkerStub::WebWorkerStub(const GURL& url, int route_id) 36 WebWorkerStub::WebWorkerStub(const GURL& url, int route_id,
37 : WebWorkerStubBase(route_id) { 37 const WorkerAppCacheInitInfo& appcache_init_info)
38 : WebWorkerStubBase(route_id, appcache_init_info) {
38 if (UrlIsNativeWorker(url)) { 39 if (UrlIsNativeWorker(url)) {
39 // Launch a native worker. 40 // Launch a native worker.
40 impl_ = NativeWebWorkerImpl::create(client()); 41 impl_ = NativeWebWorkerImpl::create(client());
41 } else { 42 } else {
42 // Launch a JavaScript worker. 43 // Launch a JavaScript worker.
43 impl_ = WebKit::WebWorker::create(client()); 44 impl_ = WebKit::WebWorker::create(client());
44 } 45 }
45 } 46 }
46 47
47 WebWorkerStub::~WebWorkerStub() { 48 WebWorkerStub::~WebWorkerStub() {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 const std::vector<int>& sent_message_port_ids, 80 const std::vector<int>& sent_message_port_ids,
80 const std::vector<int>& new_routing_ids) { 81 const std::vector<int>& new_routing_ids) {
81 WebKit::WebMessagePortChannelArray channels(sent_message_port_ids.size()); 82 WebKit::WebMessagePortChannelArray channels(sent_message_port_ids.size());
82 for (size_t i = 0; i < sent_message_port_ids.size(); i++) { 83 for (size_t i = 0; i < sent_message_port_ids.size(); i++) {
83 channels[i] = new WebMessagePortChannelImpl( 84 channels[i] = new WebMessagePortChannelImpl(
84 new_routing_ids[i], sent_message_port_ids[i]); 85 new_routing_ids[i], sent_message_port_ids[i]);
85 } 86 }
86 87
87 impl_->postMessageToWorkerContext(message, channels); 88 impl_->postMessageToWorkerContext(message, channels);
88 } 89 }
OLDNEW
« no previous file with comments | « chrome/worker/webworker_stub.h ('k') | chrome/worker/webworker_stub_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698