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 <stddef.h> | 9 #include <stddef.h> |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "base/metrics/sparse_histogram.h" | 30 #include "base/metrics/sparse_histogram.h" |
31 #include "base/profiler/scoped_tracker.h" | 31 #include "base/profiler/scoped_tracker.h" |
32 #include "base/stl_util.h" | 32 #include "base/stl_util.h" |
33 #include "base/strings/string_util.h" | 33 #include "base/strings/string_util.h" |
34 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" | 34 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
35 #include "base/time/time.h" | 35 #include "base/time/time.h" |
36 #include "content/browser/appcache/appcache_interceptor.h" | 36 #include "content/browser/appcache/appcache_interceptor.h" |
37 #include "content/browser/appcache/chrome_appcache_service.h" | 37 #include "content/browser/appcache/chrome_appcache_service.h" |
38 #include "content/browser/bad_message.h" | 38 #include "content/browser/bad_message.h" |
39 #include "content/browser/blob_storage/chrome_blob_storage_context.h" | 39 #include "content/browser/blob_storage/chrome_blob_storage_context.h" |
| 40 #include "content/browser/browsing_data/clear_site_data_throttle.h" |
40 #include "content/browser/child_process_security_policy_impl.h" | 41 #include "content/browser/child_process_security_policy_impl.h" |
41 #include "content/browser/frame_host/frame_tree.h" | 42 #include "content/browser/frame_host/frame_tree.h" |
42 #include "content/browser/frame_host/navigation_handle_impl.h" | 43 #include "content/browser/frame_host/navigation_handle_impl.h" |
43 #include "content/browser/frame_host/navigation_request_info.h" | 44 #include "content/browser/frame_host/navigation_request_info.h" |
44 #include "content/browser/frame_host/navigator.h" | 45 #include "content/browser/frame_host/navigator.h" |
45 #include "content/browser/loader/async_resource_handler.h" | 46 #include "content/browser/loader/async_resource_handler.h" |
46 #include "content/browser/loader/async_revalidation_manager.h" | 47 #include "content/browser/loader/async_revalidation_manager.h" |
47 #include "content/browser/loader/cross_site_resource_handler.h" | 48 #include "content/browser/loader/cross_site_resource_handler.h" |
48 #include "content/browser/loader/detachable_resource_handler.h" | 49 #include "content/browser/loader/detachable_resource_handler.h" |
49 #include "content/browser/loader/intercepting_resource_handler.h" | 50 #include "content/browser/loader/intercepting_resource_handler.h" |
(...skipping 1604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1654 } | 1655 } |
1655 | 1656 |
1656 if (request->has_upload()) { | 1657 if (request->has_upload()) { |
1657 // Block power save while uploading data. | 1658 // Block power save while uploading data. |
1658 throttles.push_back(new PowerSaveBlockResourceThrottle( | 1659 throttles.push_back(new PowerSaveBlockResourceThrottle( |
1659 request->url().host(), | 1660 request->url().host(), |
1660 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI), | 1661 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI), |
1661 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE))); | 1662 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE))); |
1662 } | 1663 } |
1663 | 1664 |
| 1665 // The experimental Clear-Site-Data throttle. |
| 1666 std::unique_ptr<ResourceThrottle> clear_site_data_throttle = |
| 1667 ClearSiteDataThrottle::CreateThrottleForRequest(request); |
| 1668 if (clear_site_data_throttle) |
| 1669 throttles.push_back(clear_site_data_throttle.release()); |
| 1670 |
1664 // TODO(ricea): Stop looking this up so much. | 1671 // TODO(ricea): Stop looking this up so much. |
1665 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); | 1672 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); |
1666 throttles.push_back(scheduler_->ScheduleRequest(child_id, route_id, | 1673 throttles.push_back(scheduler_->ScheduleRequest(child_id, route_id, |
1667 info->IsAsync(), request)); | 1674 info->IsAsync(), request)); |
1668 | 1675 |
1669 // Split the handler in two groups: the ones that need to execute | 1676 // Split the handler in two groups: the ones that need to execute |
1670 // WillProcessResponse before mime sniffing and the others. | 1677 // WillProcessResponse before mime sniffing and the others. |
1671 // TODO(clamy): ScopedVector is deprecated. The interface should be changed | 1678 // TODO(clamy): ScopedVector is deprecated. The interface should be changed |
1672 // to use vectors instead. | 1679 // to use vectors instead. |
1673 ScopedVector<ResourceThrottle> pre_mime_sniffing_throttles; | 1680 ScopedVector<ResourceThrottle> pre_mime_sniffing_throttles; |
(...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2710 &throttles); | 2717 &throttles); |
2711 if (!throttles.empty()) { | 2718 if (!throttles.empty()) { |
2712 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, | 2719 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, |
2713 std::move(throttles))); | 2720 std::move(throttles))); |
2714 } | 2721 } |
2715 } | 2722 } |
2716 return handler; | 2723 return handler; |
2717 } | 2724 } |
2718 | 2725 |
2719 } // namespace content | 2726 } // namespace content |
OLD | NEW |