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

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

Issue 1964273002: Add FrameHost mojo service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: android-2 Created 4 years, 7 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
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/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/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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 ReportUploadProgress(); 336 ReportUploadProgress();
338 } 337 }
339 338
340 if (rdh_->delegate()) { 339 if (rdh_->delegate()) {
341 rdh_->delegate()->OnResponseStarted( 340 rdh_->delegate()->OnResponseStarted(
342 request(), info->GetContext(), response, info->filter()); 341 request(), info->GetContext(), response, info->filter());
343 } 342 }
344 343
345 NetLogObserver::PopulateResponseInfo(request(), response); 344 NetLogObserver::PopulateResponseInfo(request(), response);
346 345
347 const HostZoomMapImpl* host_zoom_map =
wjmaclean 2016/05/16 18:53:07 If I remember correctly, this is the only consumer
scottmg 2016/05/16 22:54:56 Done.
348 static_cast<const HostZoomMapImpl*>(info->filter()->GetHostZoomMap());
349
350 if (info->GetResourceType() == RESOURCE_TYPE_MAIN_FRAME && host_zoom_map) {
351 const GURL& request_url = request()->url();
352 int render_process_id = info->GetChildID();
353 int render_view_id = info->GetRouteID();
354
355 double zoom_level = host_zoom_map->GetZoomLevelForView(
356 request_url, render_process_id, render_view_id);
357
358 info->filter()->Send(new ViewMsg_SetZoomLevelForLoadingURL(
359 render_view_id, request_url, zoom_level));
360 }
361
362 // If the parent handler downloaded the resource to a file, grant the child 346 // If the parent handler downloaded the resource to a file, grant the child
363 // read permissions on it. 347 // read permissions on it.
364 if (!response->head.download_file_path.empty()) { 348 if (!response->head.download_file_path.empty()) {
365 rdh_->RegisterDownloadedTempFile( 349 rdh_->RegisterDownloadedTempFile(
366 info->GetChildID(), info->GetRequestID(), 350 info->GetChildID(), info->GetRequestID(),
367 response->head.download_file_path); 351 response->head.download_file_path);
368 } 352 }
369 353
370 response->head.request_start = request()->creation_time(); 354 response->head.request_start = request()->creation_time();
371 response->head.response_start = TimeTicks::Now(); 355 response->head.response_start = TimeTicks::Now();
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 } else { 585 } else {
602 UMA_HISTOGRAM_CUSTOM_COUNTS( 586 UMA_HISTOGRAM_CUSTOM_COUNTS(
603 "Net.ResourceLoader.ResponseStartToEnd.Over_512kB", 587 "Net.ResourceLoader.ResponseStartToEnd.Over_512kB",
604 elapsed_time, 1, 100000, 100); 588 elapsed_time, 1, 100000, 100);
605 } 589 }
606 590
607 inlining_helper_->RecordHistogram(elapsed_time); 591 inlining_helper_->RecordHistogram(elapsed_time);
608 } 592 }
609 593
610 } // namespace content 594 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698