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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading | 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading |
6 | 6 |
7 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 7 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <set> | 10 #include <set> |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 ResourceContext* context) { | 489 ResourceContext* context) { |
490 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 490 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
491 DCHECK(context); | 491 DCHECK(context); |
492 | 492 |
493 CHECK(ContainsKey(active_resource_contexts_, context)); | 493 CHECK(ContainsKey(active_resource_contexts_, context)); |
494 | 494 |
495 // Note that request cancellation has side effects. Therefore, we gather all | 495 // Note that request cancellation has side effects. Therefore, we gather all |
496 // the requests to cancel first, and then we start cancelling. We assert at | 496 // the requests to cancel first, and then we start cancelling. We assert at |
497 // the end that there are no more to cancel since the context is about to go | 497 // the end that there are no more to cancel since the context is about to go |
498 // away. | 498 // away. |
499 typedef std::vector<linked_ptr<ResourceLoader> > LoaderList; | 499 typedef std::vector<linked_ptr<ResourceLoader>> LoaderList; |
500 LoaderList loaders_to_cancel; | 500 LoaderList loaders_to_cancel; |
501 | 501 |
502 for (LoaderMap::iterator i = pending_loaders_.begin(); | 502 for (LoaderMap::iterator i = pending_loaders_.begin(); |
503 i != pending_loaders_.end();) { | 503 i != pending_loaders_.end();) { |
504 if (i->second->GetRequestInfo()->GetContext() == context) { | 504 if (i->second->GetRequestInfo()->GetContext() == context) { |
505 loaders_to_cancel.push_back(i->second); | 505 loaders_to_cancel.push_back(i->second); |
506 IncrementOutstandingRequestsMemory(-1, *i->second->GetRequestInfo()); | 506 IncrementOutstandingRequestsMemory(-1, *i->second->GetRequestInfo()); |
507 pending_loaders_.erase(i++); | 507 pending_loaders_.erase(i++); |
508 } else { | 508 } else { |
509 ++i; | 509 ++i; |
(...skipping 1646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2156 | 2156 |
2157 // Add a flag to selectively bypass the data reduction proxy if the resource | 2157 // Add a flag to selectively bypass the data reduction proxy if the resource |
2158 // type is not an image. | 2158 // type is not an image. |
2159 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) | 2159 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) |
2160 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; | 2160 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; |
2161 | 2161 |
2162 return load_flags; | 2162 return load_flags; |
2163 } | 2163 } |
2164 | 2164 |
2165 } // namespace content | 2165 } // namespace content |
OLD | NEW |