| 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" |
| 20 #include "content/browser/loader/netlog_observer.h" | 21 #include "content/browser/loader/netlog_observer.h" |
| 21 #include "content/browser/loader/resource_buffer.h" | 22 #include "content/browser/loader/resource_buffer.h" |
| 22 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 23 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
| 23 #include "content/browser/loader/resource_message_filter.h" | 24 #include "content/browser/loader/resource_message_filter.h" |
| 24 #include "content/browser/loader/resource_request_info_impl.h" | 25 #include "content/browser/loader/resource_request_info_impl.h" |
| 25 #include "content/browser/resource_context_impl.h" | 26 #include "content/browser/resource_context_impl.h" |
| 26 #include "content/common/resource_messages.h" | 27 #include "content/common/resource_messages.h" |
| 27 #include "content/common/resource_request_completion_status.h" | 28 #include "content/common/resource_request_completion_status.h" |
| 28 #include "content/common/view_messages.h" | 29 #include "content/common/view_messages.h" |
| 29 #include "content/public/browser/resource_dispatcher_host_delegate.h" | 30 #include "content/public/browser/resource_dispatcher_host_delegate.h" |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 ReportUploadProgress(); | 339 ReportUploadProgress(); |
| 339 } | 340 } |
| 340 | 341 |
| 341 if (rdh_->delegate()) { | 342 if (rdh_->delegate()) { |
| 342 rdh_->delegate()->OnResponseStarted( | 343 rdh_->delegate()->OnResponseStarted( |
| 343 request(), info->GetContext(), response, info->filter()); | 344 request(), info->GetContext(), response, info->filter()); |
| 344 } | 345 } |
| 345 | 346 |
| 346 NetLogObserver::PopulateResponseInfo(request(), response); | 347 NetLogObserver::PopulateResponseInfo(request(), response); |
| 347 | 348 |
| 349 const HostZoomMapImpl* host_zoom_map = |
| 350 static_cast<const HostZoomMapImpl*>(info->filter()->GetHostZoomMap()); |
| 351 |
| 352 if (info->GetResourceType() == RESOURCE_TYPE_MAIN_FRAME && host_zoom_map) { |
| 353 const GURL& request_url = request()->url(); |
| 354 int render_process_id = info->GetChildID(); |
| 355 int render_view_id = info->GetRouteID(); |
| 356 |
| 357 double zoom_level = host_zoom_map->GetZoomLevelForView( |
| 358 request_url, render_process_id, render_view_id); |
| 359 |
| 360 info->filter()->Send(new ViewMsg_SetZoomLevelForLoadingURL( |
| 361 render_view_id, request_url, zoom_level)); |
| 362 } |
| 363 |
| 348 // If the parent handler downloaded the resource to a file, grant the child | 364 // If the parent handler downloaded the resource to a file, grant the child |
| 349 // read permissions on it. | 365 // read permissions on it. |
| 350 if (!response->head.download_file_path.empty()) { | 366 if (!response->head.download_file_path.empty()) { |
| 351 rdh_->RegisterDownloadedTempFile( | 367 rdh_->RegisterDownloadedTempFile( |
| 352 info->GetChildID(), info->GetRequestID(), | 368 info->GetChildID(), info->GetRequestID(), |
| 353 response->head.download_file_path); | 369 response->head.download_file_path); |
| 354 } | 370 } |
| 355 | 371 |
| 356 response->head.request_start = request()->creation_time(); | 372 response->head.request_start = request()->creation_time(); |
| 357 response->head.response_start = TimeTicks::Now(); | 373 response->head.response_start = TimeTicks::Now(); |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 } else { | 603 } else { |
| 588 UMA_HISTOGRAM_CUSTOM_COUNTS( | 604 UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 589 "Net.ResourceLoader.ResponseStartToEnd.Over_512kB", | 605 "Net.ResourceLoader.ResponseStartToEnd.Over_512kB", |
| 590 elapsed_time, 1, 100000, 100); | 606 elapsed_time, 1, 100000, 100); |
| 591 } | 607 } |
| 592 | 608 |
| 593 inlining_helper_->RecordHistogram(elapsed_time); | 609 inlining_helper_->RecordHistogram(elapsed_time); |
| 594 } | 610 } |
| 595 | 611 |
| 596 } // namespace content | 612 } // namespace content |
| OLD | NEW |