| 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/loader/async_resource_handler.h" | 5 #include "content/browser/loader/async_resource_handler.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/containers/hash_tables.h" | 11 #include "base/containers/hash_tables.h" |
| 12 #include "base/debug/alias.h" | 12 #include "base/debug/alias.h" |
| 13 #include "base/feature_list.h" | 13 #include "base/feature_list.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/shared_memory.h" | 16 #include "base/memory/shared_memory.h" |
| 17 #include "base/metrics/histogram_macros.h" | 17 #include "base/metrics/histogram_macros.h" |
| 18 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
| 19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
| 20 #include "content/browser/host_zoom_map_impl.h" | |
| 21 #include "content/browser/loader/netlog_observer.h" | 20 #include "content/browser/loader/netlog_observer.h" |
| 22 #include "content/browser/loader/resource_buffer.h" | 21 #include "content/browser/loader/resource_buffer.h" |
| 23 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 22 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
| 24 #include "content/browser/loader/resource_message_filter.h" | 23 #include "content/browser/loader/resource_message_filter.h" |
| 25 #include "content/browser/loader/resource_request_info_impl.h" | 24 #include "content/browser/loader/resource_request_info_impl.h" |
| 26 #include "content/common/resource_messages.h" | 25 #include "content/common/resource_messages.h" |
| 27 #include "content/common/resource_request_completion_status.h" | 26 #include "content/common/resource_request_completion_status.h" |
| 28 #include "content/common/view_messages.h" | 27 #include "content/common/view_messages.h" |
| 29 #include "content/public/browser/resource_dispatcher_host_delegate.h" | 28 #include "content/public/browser/resource_dispatcher_host_delegate.h" |
| 30 #include "content/public/common/content_features.h" | 29 #include "content/public/common/content_features.h" |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 } | 344 } |
| 346 | 345 |
| 347 if (rdh_->delegate()) { | 346 if (rdh_->delegate()) { |
| 348 rdh_->delegate()->OnResponseStarted(request(), info->GetContext(), | 347 rdh_->delegate()->OnResponseStarted(request(), info->GetContext(), |
| 349 response); | 348 response); |
| 350 } | 349 } |
| 351 | 350 |
| 352 NetLogObserver::PopulateResponseInfo(request(), response); | 351 NetLogObserver::PopulateResponseInfo(request(), response); |
| 353 response->head.encoded_data_length = request()->raw_header_size(); | 352 response->head.encoded_data_length = request()->raw_header_size(); |
| 354 | 353 |
| 355 const HostZoomMapImpl* host_zoom_map = | |
| 356 static_cast<const HostZoomMapImpl*>(info->filter()->GetHostZoomMap()); | |
| 357 | |
| 358 if (info->GetResourceType() == RESOURCE_TYPE_MAIN_FRAME && host_zoom_map) { | |
| 359 const GURL& request_url = request()->url(); | |
| 360 int render_process_id = info->GetChildID(); | |
| 361 int render_view_id = info->GetRouteID(); | |
| 362 | |
| 363 double zoom_level = host_zoom_map->GetZoomLevelForView( | |
| 364 request_url, render_process_id, render_view_id); | |
| 365 | |
| 366 info->filter()->Send(new ViewMsg_SetZoomLevelForLoadingURL( | |
| 367 render_view_id, request_url, zoom_level)); | |
| 368 } | |
| 369 | |
| 370 // If the parent handler downloaded the resource to a file, grant the child | 354 // If the parent handler downloaded the resource to a file, grant the child |
| 371 // read permissions on it. | 355 // read permissions on it. |
| 372 if (!response->head.download_file_path.empty()) { | 356 if (!response->head.download_file_path.empty()) { |
| 373 rdh_->RegisterDownloadedTempFile( | 357 rdh_->RegisterDownloadedTempFile( |
| 374 info->GetChildID(), info->GetRequestID(), | 358 info->GetChildID(), info->GetRequestID(), |
| 375 response->head.download_file_path); | 359 response->head.download_file_path); |
| 376 } | 360 } |
| 377 | 361 |
| 378 response->head.request_start = request()->creation_time(); | 362 response->head.request_start = request()->creation_time(); |
| 379 response->head.response_start = TimeTicks::Now(); | 363 response->head.response_start = TimeTicks::Now(); |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 } else { | 587 } else { |
| 604 UMA_HISTOGRAM_CUSTOM_COUNTS( | 588 UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 605 "Net.ResourceLoader.ResponseStartToEnd.Over_512kB", | 589 "Net.ResourceLoader.ResponseStartToEnd.Over_512kB", |
| 606 elapsed_time, 1, 100000, 100); | 590 elapsed_time, 1, 100000, 100); |
| 607 } | 591 } |
| 608 | 592 |
| 609 inlining_helper_->RecordHistogram(elapsed_time); | 593 inlining_helper_->RecordHistogram(elapsed_time); |
| 610 } | 594 } |
| 611 | 595 |
| 612 } // namespace content | 596 } // namespace content |
| OLD | NEW |