| 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/browser/renderer_host/resource_dispatcher_host_impl.h" | 5 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 // This is used to emulate different sub-processes, since this filter will | 175 // This is used to emulate different sub-processes, since this filter will |
| 176 // have a different ID than the original. For the test, we want all the incoming | 176 // have a different ID than the original. For the test, we want all the incoming |
| 177 // messages to go to the same place, which is why this forwards. | 177 // messages to go to the same place, which is why this forwards. |
| 178 class ForwardingFilter : public ResourceMessageFilter { | 178 class ForwardingFilter : public ResourceMessageFilter { |
| 179 public: | 179 public: |
| 180 explicit ForwardingFilter(IPC::Sender* dest, | 180 explicit ForwardingFilter(IPC::Sender* dest, |
| 181 content::ResourceContext* resource_context) | 181 content::ResourceContext* resource_context) |
| 182 : ResourceMessageFilter( | 182 : ResourceMessageFilter( |
| 183 ChildProcessHostImpl::GenerateChildProcessUniqueId(), | 183 ChildProcessHostImpl::GenerateChildProcessUniqueId(), |
| 184 content::PROCESS_TYPE_RENDERER, | 184 content::PROCESS_TYPE_RENDERER, |
| 185 resource_context, | 185 resource_context, NULL, NULL, |
| 186 new MockURLRequestContextSelector( | 186 new MockURLRequestContextSelector( |
| 187 resource_context->GetRequestContext())), | 187 resource_context->GetRequestContext())), |
| 188 dest_(dest) { | 188 dest_(dest) { |
| 189 OnChannelConnected(base::GetCurrentProcId()); | 189 OnChannelConnected(base::GetCurrentProcId()); |
| 190 } | 190 } |
| 191 | 191 |
| 192 // ResourceMessageFilter override | 192 // ResourceMessageFilter override |
| 193 virtual bool Send(IPC::Message* msg) { | 193 virtual bool Send(IPC::Message* msg) { |
| 194 if (!dest_) | 194 if (!dest_) |
| 195 return false; | 195 return false; |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 | 423 |
| 424 void set_defer_flags(int value) { | 424 void set_defer_flags(int value) { |
| 425 defer_flags_ = value; | 425 defer_flags_ = value; |
| 426 } | 426 } |
| 427 | 427 |
| 428 // ResourceDispatcherHostDelegate implementation: | 428 // ResourceDispatcherHostDelegate implementation: |
| 429 | 429 |
| 430 virtual void RequestBeginning( | 430 virtual void RequestBeginning( |
| 431 net::URLRequest* request, | 431 net::URLRequest* request, |
| 432 content::ResourceContext* resource_context, | 432 content::ResourceContext* resource_context, |
| 433 appcache::AppCacheService* appcache_service, |
| 433 ResourceType::Type resource_type, | 434 ResourceType::Type resource_type, |
| 434 int child_id, | 435 int child_id, |
| 435 int route_id, | 436 int route_id, |
| 436 bool is_continuation_of_transferred_request, | 437 bool is_continuation_of_transferred_request, |
| 437 ScopedVector<content::ResourceThrottle>* throttles) OVERRIDE { | 438 ScopedVector<content::ResourceThrottle>* throttles) OVERRIDE { |
| 438 if (user_data_.get()) { | 439 if (user_data_.get()) { |
| 439 const void* key = user_data_.get(); | 440 const void* key = user_data_.get(); |
| 440 request->SetUserData(key, user_data_.release()); | 441 request->SetUserData(key, user_data_.release()); |
| 441 } | 442 } |
| 442 | 443 |
| (...skipping 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1762 } | 1763 } |
| 1763 | 1764 |
| 1764 MessageLoop::current()->RunAllPending(); | 1765 MessageLoop::current()->RunAllPending(); |
| 1765 | 1766 |
| 1766 msgs.clear(); | 1767 msgs.clear(); |
| 1767 accum_.GetClassifiedMessages(&msgs); | 1768 accum_.GetClassifiedMessages(&msgs); |
| 1768 } | 1769 } |
| 1769 } | 1770 } |
| 1770 | 1771 |
| 1771 } // namespace content | 1772 } // namespace content |
| OLD | NEW |