Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Side by Side Diff: content/browser/loader/async_resource_handler.cc

Issue 2374863002: Remove usage of HostZoomMap from c/b/loader via ReadyToCommitNavigation (Closed)
Patch Set: init Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/loader/DEPS ('k') | content/browser/loader/async_resource_handler_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 } 343 }
345 344
346 if (rdh_->delegate()) { 345 if (rdh_->delegate()) {
347 rdh_->delegate()->OnResponseStarted(request(), info->GetContext(), 346 rdh_->delegate()->OnResponseStarted(request(), info->GetContext(),
348 response); 347 response);
349 } 348 }
350 349
351 NetLogObserver::PopulateResponseInfo(request(), response); 350 NetLogObserver::PopulateResponseInfo(request(), response);
352 response->head.encoded_data_length = request()->raw_header_size(); 351 response->head.encoded_data_length = request()->raw_header_size();
353 352
354 const HostZoomMapImpl* host_zoom_map =
355 static_cast<const HostZoomMapImpl*>(info->filter()->GetHostZoomMap());
356
357 if (info->GetResourceType() == RESOURCE_TYPE_MAIN_FRAME && host_zoom_map) {
358 const GURL& request_url = request()->url();
359 int render_process_id = info->GetChildID();
360 int render_view_id = info->GetRouteID();
361
362 double zoom_level = host_zoom_map->GetZoomLevelForView(
363 request_url, render_process_id, render_view_id);
364
365 info->filter()->Send(new ViewMsg_SetZoomLevelForLoadingURL(
366 render_view_id, request_url, zoom_level));
367 }
368
369 // If the parent handler downloaded the resource to a file, grant the child 353 // If the parent handler downloaded the resource to a file, grant the child
370 // read permissions on it. 354 // read permissions on it.
371 if (!response->head.download_file_path.empty()) { 355 if (!response->head.download_file_path.empty()) {
372 rdh_->RegisterDownloadedTempFile( 356 rdh_->RegisterDownloadedTempFile(
373 info->GetChildID(), info->GetRequestID(), 357 info->GetChildID(), info->GetRequestID(),
374 response->head.download_file_path); 358 response->head.download_file_path);
375 } 359 }
376 360
377 response->head.request_start = request()->creation_time(); 361 response->head.request_start = request()->creation_time();
378 response->head.response_start = TimeTicks::Now(); 362 response->head.response_start = TimeTicks::Now();
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « content/browser/loader/DEPS ('k') | content/browser/loader/async_resource_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698