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 21 matching lines...) Expand all Loading... |
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/threading/thread_task_runner_handle.h" | 35 #include "base/threading/thread_task_runner_handle.h" |
36 #include "base/timer/timer.h" | 36 #include "base/timer/timer.h" |
37 #include "content/browser/appcache/appcache_interceptor.h" | 37 #include "content/browser/appcache/appcache_interceptor.h" |
38 #include "content/browser/appcache/appcache_navigation_handle_core.h" | 38 #include "content/browser/appcache/appcache_navigation_handle_core.h" |
39 #include "content/browser/appcache/chrome_appcache_service.h" | 39 #include "content/browser/appcache/chrome_appcache_service.h" |
40 #include "content/browser/bad_message.h" | 40 #include "content/browser/bad_message.h" |
41 #include "content/browser/blob_storage/chrome_blob_storage_context.h" | 41 #include "content/browser/blob_storage/chrome_blob_storage_context.h" |
| 42 #include "content/browser/browsing_data/clear_site_data_throttle.h" |
42 #include "content/browser/child_process_security_policy_impl.h" | 43 #include "content/browser/child_process_security_policy_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/loader/async_resource_handler.h" | 45 #include "content/browser/loader/async_resource_handler.h" |
45 #include "content/browser/loader/detachable_resource_handler.h" | 46 #include "content/browser/loader/detachable_resource_handler.h" |
46 #include "content/browser/loader/intercepting_resource_handler.h" | 47 #include "content/browser/loader/intercepting_resource_handler.h" |
47 #include "content/browser/loader/loader_delegate.h" | 48 #include "content/browser/loader/loader_delegate.h" |
48 #include "content/browser/loader/mime_sniffing_resource_handler.h" | 49 #include "content/browser/loader/mime_sniffing_resource_handler.h" |
49 #include "content/browser/loader/mojo_async_resource_handler.h" | 50 #include "content/browser/loader/mojo_async_resource_handler.h" |
50 #include "content/browser/loader/navigation_resource_handler.h" | 51 #include "content/browser/loader/navigation_resource_handler.h" |
51 #include "content/browser/loader/navigation_resource_throttle.h" | 52 #include "content/browser/loader/navigation_resource_throttle.h" |
(...skipping 1497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1549 &throttles); | 1550 &throttles); |
1550 } | 1551 } |
1551 | 1552 |
1552 if (request->has_upload()) { | 1553 if (request->has_upload()) { |
1553 // Block power save while uploading data. | 1554 // Block power save while uploading data. |
1554 throttles.push_back(base::MakeUnique<PowerSaveBlockResourceThrottle>( | 1555 throttles.push_back(base::MakeUnique<PowerSaveBlockResourceThrottle>( |
1555 request->url().host(), main_thread_task_runner_, | 1556 request->url().host(), main_thread_task_runner_, |
1556 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE))); | 1557 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE))); |
1557 } | 1558 } |
1558 | 1559 |
| 1560 // The experimental Clear-Site-Data throttle. |
| 1561 std::unique_ptr<ResourceThrottle> clear_site_data_throttle = |
| 1562 ClearSiteDataThrottle::CreateThrottleForRequest(request); |
| 1563 if (clear_site_data_throttle) |
| 1564 throttles.push_back(std::move(clear_site_data_throttle)); |
| 1565 |
1559 // TODO(ricea): Stop looking this up so much. | 1566 // TODO(ricea): Stop looking this up so much. |
1560 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); | 1567 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); |
1561 throttles.push_back(scheduler_->ScheduleRequest(child_id, route_id, | 1568 throttles.push_back(scheduler_->ScheduleRequest(child_id, route_id, |
1562 info->IsAsync(), request)); | 1569 info->IsAsync(), request)); |
1563 | 1570 |
1564 // Split the handler in two groups: the ones that need to execute | 1571 // Split the handler in two groups: the ones that need to execute |
1565 // WillProcessResponse before mime sniffing and the others. | 1572 // WillProcessResponse before mime sniffing and the others. |
1566 std::vector<std::unique_ptr<ResourceThrottle>> pre_mime_sniffing_throttles; | 1573 std::vector<std::unique_ptr<ResourceThrottle>> pre_mime_sniffing_throttles; |
1567 std::vector<std::unique_ptr<ResourceThrottle>> post_mime_sniffing_throttles; | 1574 std::vector<std::unique_ptr<ResourceThrottle>> post_mime_sniffing_throttles; |
1568 for (auto& throttle : throttles) { | 1575 for (auto& throttle : throttles) { |
(...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2671 &throttles); | 2678 &throttles); |
2672 if (!throttles.empty()) { | 2679 if (!throttles.empty()) { |
2673 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, | 2680 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, |
2674 std::move(throttles))); | 2681 std::move(throttles))); |
2675 } | 2682 } |
2676 } | 2683 } |
2677 return handler; | 2684 return handler; |
2678 } | 2685 } |
2679 | 2686 |
2680 } // namespace content | 2687 } // namespace content |
OLD | NEW |