| 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> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/bind.h" | 13 #include "base/bind.h" |
| 14 #include "base/bind_helpers.h" | 14 #include "base/bind_helpers.h" |
| 15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 16 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
| 17 #include "base/debug/alias.h" | 17 #include "base/debug/alias.h" |
| 18 #include "base/logging.h" | 18 #include "base/logging.h" |
| 19 #include "base/memory/scoped_ptr.h" | 19 #include "base/memory/scoped_ptr.h" |
| 20 #include "base/memory/shared_memory.h" | 20 #include "base/memory/shared_memory.h" |
| 21 #include "base/message_loop/message_loop.h" | 21 #include "base/message_loop/message_loop.h" |
| 22 #include "base/metrics/histogram.h" | 22 #include "base/metrics/histogram.h" |
| 23 #include "base/metrics/sparse_histogram.h" | 23 #include "base/metrics/sparse_histogram.h" |
| 24 #include "base/profiler/scoped_tracker.h" |
| 24 #include "base/stl_util.h" | 25 #include "base/stl_util.h" |
| 25 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" | 26 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
| 26 #include "content/browser/appcache/appcache_interceptor.h" | 27 #include "content/browser/appcache/appcache_interceptor.h" |
| 27 #include "content/browser/appcache/chrome_appcache_service.h" | 28 #include "content/browser/appcache/chrome_appcache_service.h" |
| 28 #include "content/browser/cert_store_impl.h" | 29 #include "content/browser/cert_store_impl.h" |
| 29 #include "content/browser/child_process_security_policy_impl.h" | 30 #include "content/browser/child_process_security_policy_impl.h" |
| 30 #include "content/browser/download/download_resource_handler.h" | 31 #include "content/browser/download/download_resource_handler.h" |
| 31 #include "content/browser/download/save_file_manager.h" | 32 #include "content/browser/download/save_file_manager.h" |
| 32 #include "content/browser/download/save_file_resource_handler.h" | 33 #include "content/browser/download/save_file_resource_handler.h" |
| 33 #include "content/browser/fileapi/chrome_blob_storage_context.h" | 34 #include "content/browser/fileapi/chrome_blob_storage_context.h" |
| (...skipping 2110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2144 if (view) // The view could be gone at this point. | 2145 if (view) // The view could be gone at this point. |
| 2145 view->LoadStateChanged(i->second.url, i->second.load_state, | 2146 view->LoadStateChanged(i->second.url, i->second.load_state, |
| 2146 i->second.upload_position, | 2147 i->second.upload_position, |
| 2147 i->second.upload_size); | 2148 i->second.upload_size); |
| 2148 } | 2149 } |
| 2149 } | 2150 } |
| 2150 | 2151 |
| 2151 } // namespace | 2152 } // namespace |
| 2152 | 2153 |
| 2153 void ResourceDispatcherHostImpl::UpdateLoadStates() { | 2154 void ResourceDispatcherHostImpl::UpdateLoadStates() { |
| 2155 // TODO(pkasting): Remove ScopedTracker below once crbug.com/455952 is |
| 2156 // fixed. |
| 2157 tracked_objects::ScopedTracker tracking_profile( |
| 2158 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 2159 "455952 ResourceDispatcherHostImpl::UpdateLoadStates")); |
| 2154 // Populate this map with load state changes, and then send them on to the UI | 2160 // Populate this map with load state changes, and then send them on to the UI |
| 2155 // thread where they can be passed along to the respective RVHs. | 2161 // thread where they can be passed along to the respective RVHs. |
| 2156 LoadInfoMap info_map; | 2162 LoadInfoMap info_map; |
| 2157 | 2163 |
| 2158 LoaderMap::const_iterator i; | 2164 LoaderMap::const_iterator i; |
| 2159 | 2165 |
| 2160 // Determine the largest upload size of all requests | 2166 // Determine the largest upload size of all requests |
| 2161 // in each View (good chance it's zero). | 2167 // in each View (good chance it's zero). |
| 2162 std::map<GlobalRoutingID, uint64> largest_upload_size; | 2168 std::map<GlobalRoutingID, uint64> largest_upload_size; |
| 2163 for (i = pending_loaders_.begin(); i != pending_loaders_.end(); ++i) { | 2169 for (i = pending_loaders_.begin(); i != pending_loaders_.end(); ++i) { |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2368 | 2374 |
| 2369 // Add a flag to selectively bypass the data reduction proxy if the resource | 2375 // Add a flag to selectively bypass the data reduction proxy if the resource |
| 2370 // type is not an image. | 2376 // type is not an image. |
| 2371 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) | 2377 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) |
| 2372 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; | 2378 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; |
| 2373 | 2379 |
| 2374 return load_flags; | 2380 return load_flags; |
| 2375 } | 2381 } |
| 2376 | 2382 |
| 2377 } // namespace content | 2383 } // namespace content |
| OLD | NEW |