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/common/resource_messages.h" | 26 #include "content/common/resource_messages.h" |
26 #include "content/common/resource_request_completion_status.h" | 27 #include "content/common/resource_request_completion_status.h" |
27 #include "content/common/view_messages.h" | 28 #include "content/common/view_messages.h" |
28 #include "content/public/browser/resource_dispatcher_host_delegate.h" | 29 #include "content/public/browser/resource_dispatcher_host_delegate.h" |
29 #include "content/public/common/content_features.h" | 30 #include "content/public/common/content_features.h" |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 ReportUploadProgress(); | 350 ReportUploadProgress(); |
350 } | 351 } |
351 | 352 |
352 if (rdh_->delegate()) { | 353 if (rdh_->delegate()) { |
353 rdh_->delegate()->OnResponseStarted(request(), info->GetContext(), | 354 rdh_->delegate()->OnResponseStarted(request(), info->GetContext(), |
354 response); | 355 response); |
355 } | 356 } |
356 | 357 |
357 NetLogObserver::PopulateResponseInfo(request(), response); | 358 NetLogObserver::PopulateResponseInfo(request(), response); |
358 | 359 |
| 360 const HostZoomMapImpl* host_zoom_map = |
| 361 static_cast<const HostZoomMapImpl*>(info->filter()->GetHostZoomMap()); |
| 362 |
| 363 if (info->GetResourceType() == RESOURCE_TYPE_MAIN_FRAME && host_zoom_map) { |
| 364 const GURL& request_url = request()->url(); |
| 365 int render_process_id = info->GetChildID(); |
| 366 int render_view_id = info->GetRouteID(); |
| 367 |
| 368 double zoom_level = host_zoom_map->GetZoomLevelForView( |
| 369 request_url, render_process_id, render_view_id); |
| 370 |
| 371 info->filter()->Send(new ViewMsg_SetZoomLevelForLoadingURL( |
| 372 render_view_id, request_url, zoom_level)); |
| 373 } |
| 374 |
359 // If the parent handler downloaded the resource to a file, grant the child | 375 // If the parent handler downloaded the resource to a file, grant the child |
360 // read permissions on it. | 376 // read permissions on it. |
361 if (!response->head.download_file_path.empty()) { | 377 if (!response->head.download_file_path.empty()) { |
362 rdh_->RegisterDownloadedTempFile( | 378 rdh_->RegisterDownloadedTempFile( |
363 info->GetChildID(), info->GetRequestID(), | 379 info->GetChildID(), info->GetRequestID(), |
364 response->head.download_file_path); | 380 response->head.download_file_path); |
365 } | 381 } |
366 | 382 |
367 response->head.request_start = request()->creation_time(); | 383 response->head.request_start = request()->creation_time(); |
368 response->head.response_start = TimeTicks::Now(); | 384 response->head.response_start = TimeTicks::Now(); |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 } else { | 606 } else { |
591 UMA_HISTOGRAM_CUSTOM_COUNTS( | 607 UMA_HISTOGRAM_CUSTOM_COUNTS( |
592 "Net.ResourceLoader.ResponseStartToEnd.Over_512kB", | 608 "Net.ResourceLoader.ResponseStartToEnd.Over_512kB", |
593 elapsed_time, 1, 100000, 100); | 609 elapsed_time, 1, 100000, 100); |
594 } | 610 } |
595 | 611 |
596 inlining_helper_->RecordHistogram(elapsed_time); | 612 inlining_helper_->RecordHistogram(elapsed_time); |
597 } | 613 } |
598 | 614 |
599 } // namespace content | 615 } // namespace content |
OLD | NEW |