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