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

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

Issue 2211713002: Remove dependency of c/b/loader on c/b/host_zoom_map_impl.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 4 months 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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 ReportUploadProgress(); 349 ReportUploadProgress();
351 } 350 }
352 351
353 if (rdh_->delegate()) { 352 if (rdh_->delegate()) {
354 rdh_->delegate()->OnResponseStarted(request(), info->GetContext(), 353 rdh_->delegate()->OnResponseStarted(request(), info->GetContext(),
355 response); 354 response);
356 } 355 }
357 356
358 NetLogObserver::PopulateResponseInfo(request(), response); 357 NetLogObserver::PopulateResponseInfo(request(), response);
359 358
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
375 // If the parent handler downloaded the resource to a file, grant the child 359 // If the parent handler downloaded the resource to a file, grant the child
376 // read permissions on it. 360 // read permissions on it.
377 if (!response->head.download_file_path.empty()) { 361 if (!response->head.download_file_path.empty()) {
378 rdh_->RegisterDownloadedTempFile( 362 rdh_->RegisterDownloadedTempFile(
379 info->GetChildID(), info->GetRequestID(), 363 info->GetChildID(), info->GetRequestID(),
380 response->head.download_file_path); 364 response->head.download_file_path);
381 } 365 }
382 366
383 response->head.request_start = request()->creation_time(); 367 response->head.request_start = request()->creation_time();
384 response->head.response_start = TimeTicks::Now(); 368 response->head.response_start = TimeTicks::Now();
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 } else { 590 } else {
607 UMA_HISTOGRAM_CUSTOM_COUNTS( 591 UMA_HISTOGRAM_CUSTOM_COUNTS(
608 "Net.ResourceLoader.ResponseStartToEnd.Over_512kB", 592 "Net.ResourceLoader.ResponseStartToEnd.Over_512kB",
609 elapsed_time, 1, 100000, 100); 593 elapsed_time, 1, 100000, 100);
610 } 594 }
611 595
612 inlining_helper_->RecordHistogram(elapsed_time); 596 inlining_helper_->RecordHistogram(elapsed_time);
613 } 597 }
614 598
615 } // namespace content 599 } // 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