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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| 11 #include "base/location.h" |
11 #include "base/memory/scoped_vector.h" | 12 #include "base/memory/scoped_vector.h" |
12 #include "base/memory/shared_memory.h" | 13 #include "base/memory/shared_memory.h" |
13 #include "base/message_loop/message_loop.h" | |
14 #include "base/pickle.h" | 14 #include "base/pickle.h" |
15 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
| 16 #include "base/single_thread_task_runner.h" |
16 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
17 #include "base/strings/string_split.h" | 18 #include "base/strings/string_split.h" |
| 19 #include "base/thread_task_runner_handle.h" |
18 #include "content/browser/browser_thread_impl.h" | 20 #include "content/browser/browser_thread_impl.h" |
19 #include "content/browser/child_process_security_policy_impl.h" | 21 #include "content/browser/child_process_security_policy_impl.h" |
20 #include "content/browser/loader/cross_site_resource_handler.h" | 22 #include "content/browser/loader/cross_site_resource_handler.h" |
21 #include "content/browser/loader/detachable_resource_handler.h" | 23 #include "content/browser/loader/detachable_resource_handler.h" |
22 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 24 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
23 #include "content/browser/loader/resource_loader.h" | 25 #include "content/browser/loader/resource_loader.h" |
24 #include "content/browser/loader/resource_message_filter.h" | 26 #include "content/browser/loader/resource_message_filter.h" |
25 #include "content/browser/loader/resource_request_info_impl.h" | 27 #include "content/browser/loader/resource_request_info_impl.h" |
26 #include "content/common/appcache_interfaces.h" | 28 #include "content/common/appcache_interfaces.h" |
27 #include "content/common/child_process_host_impl.h" | 29 #include "content/common/child_process_host_impl.h" |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 return net::ERR_INVALID_URL; | 437 return net::ERR_INVALID_URL; |
436 | 438 |
437 data->reserve(text.size() * count); | 439 data->reserve(text.size() * count); |
438 for (int i = 0; i < count; ++i) | 440 for (int i = 0; i < count; ++i) |
439 data->append(text); | 441 data->append(text); |
440 | 442 |
441 return net::OK; | 443 return net::OK; |
442 } | 444 } |
443 | 445 |
444 base::TaskRunner* GetTaskRunner() const override { | 446 base::TaskRunner* GetTaskRunner() const override { |
445 return base::MessageLoopProxy::current().get(); | 447 return base::ThreadTaskRunnerHandle::Get().get(); |
446 } | 448 } |
447 | 449 |
448 private: | 450 private: |
449 ~URLRequestBigJob() override {} | 451 ~URLRequestBigJob() override {} |
450 | 452 |
451 // big-job:substring,N | 453 // big-job:substring,N |
452 static bool ParseURL(const GURL& url, std::string* text, int* count) { | 454 static bool ParseURL(const GURL& url, std::string* text, int* count) { |
453 std::vector<std::string> parts; | 455 std::vector<std::string> parts; |
454 base::SplitString(url.path(), ',', &parts); | 456 base::SplitString(url.path(), ',', &parts); |
455 | 457 |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 | 917 |
916 void GenerateDataReceivedACK(const IPC::Message& msg) { | 918 void GenerateDataReceivedACK(const IPC::Message& msg) { |
917 EXPECT_EQ(ResourceMsg_DataReceived::ID, msg.type()); | 919 EXPECT_EQ(ResourceMsg_DataReceived::ID, msg.type()); |
918 | 920 |
919 int request_id = -1; | 921 int request_id = -1; |
920 bool result = base::PickleIterator(msg).ReadInt(&request_id); | 922 bool result = base::PickleIterator(msg).ReadInt(&request_id); |
921 DCHECK(result); | 923 DCHECK(result); |
922 scoped_ptr<IPC::Message> ack( | 924 scoped_ptr<IPC::Message> ack( |
923 new ResourceHostMsg_DataReceived_ACK(request_id)); | 925 new ResourceHostMsg_DataReceived_ACK(request_id)); |
924 | 926 |
925 base::MessageLoop::current()->PostTask( | 927 base::ThreadTaskRunnerHandle::Get()->PostTask( |
926 FROM_HERE, | 928 FROM_HERE, |
927 base::Bind(&GenerateIPCMessage, filter_, base::Passed(&ack))); | 929 base::Bind(&GenerateIPCMessage, filter_, base::Passed(&ack))); |
928 } | 930 } |
929 | 931 |
930 // Setting filters for testing renderer messages. | 932 // Setting filters for testing renderer messages. |
931 // Returns the previous filter. | 933 // Returns the previous filter. |
932 ResourceMessageFilter* SetFilter(ResourceMessageFilter* new_filter) { | 934 ResourceMessageFilter* SetFilter(ResourceMessageFilter* new_filter) { |
933 ResourceMessageFilter* old_filter = host_.filter_; | 935 ResourceMessageFilter* old_filter = host_.filter_; |
934 host_.filter_ = new_filter; | 936 host_.filter_ = new_filter; |
935 return old_filter; | 937 return old_filter; |
(...skipping 2306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3242 return nullptr; | 3244 return nullptr; |
3243 } | 3245 } |
3244 | 3246 |
3245 net::URLRequestJob* TestURLRequestJobFactory::MaybeInterceptResponse( | 3247 net::URLRequestJob* TestURLRequestJobFactory::MaybeInterceptResponse( |
3246 net::URLRequest* request, | 3248 net::URLRequest* request, |
3247 net::NetworkDelegate* network_delegate) const { | 3249 net::NetworkDelegate* network_delegate) const { |
3248 return nullptr; | 3250 return nullptr; |
3249 } | 3251 } |
3250 | 3252 |
3251 } // namespace content | 3253 } // namespace content |
OLD | NEW |