| 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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading | 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading |
| 6 | 6 |
| 7 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 7 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 971 filter_ = NULL; | 971 filter_ = NULL; |
| 972 return handled; | 972 return handled; |
| 973 } | 973 } |
| 974 | 974 |
| 975 void ResourceDispatcherHostImpl::OnRequestResource( | 975 void ResourceDispatcherHostImpl::OnRequestResource( |
| 976 int routing_id, | 976 int routing_id, |
| 977 int request_id, | 977 int request_id, |
| 978 const ResourceHostMsg_Request& request_data) { | 978 const ResourceHostMsg_Request& request_data) { |
| 979 // When logging time-to-network only care about main frame and non-transfer | 979 // When logging time-to-network only care about main frame and non-transfer |
| 980 // navigations. | 980 // navigations. |
| 981 if (request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME && | 981 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 982 switches::kEnableBrowserSideNavigation) && |
| 983 request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME && |
| 982 request_data.transferred_request_request_id == -1) { | 984 request_data.transferred_request_request_id == -1) { |
| 983 BrowserThread::PostTask( | 985 BrowserThread::PostTask( |
| 984 BrowserThread::UI, | 986 BrowserThread::UI, |
| 985 FROM_HERE, | 987 FROM_HERE, |
| 986 base::Bind(&LogResourceRequestTimeOnUI, | 988 base::Bind(&LogResourceRequestTimeOnUI, |
| 987 TimeTicks::Now(), | 989 TimeTicks::Now(), |
| 988 filter_->child_id(), | 990 filter_->child_id(), |
| 989 request_data.render_frame_id, | 991 request_data.render_frame_id, |
| 990 request_data.url)); | 992 request_data.url)); |
| 991 } | 993 } |
| (...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2000 // TODO(davidben): Pass in the appropriate appcache_service. Also fix the | 2002 // TODO(davidben): Pass in the appropriate appcache_service. Also fix the |
| 2001 // dependency on child_id/route_id. Those are used by the ResourceScheduler; | 2003 // dependency on child_id/route_id. Those are used by the ResourceScheduler; |
| 2002 // currently it's a no-op. | 2004 // currently it's a no-op. |
| 2003 handler = AddStandardHandlers(new_request.get(), resource_type, | 2005 handler = AddStandardHandlers(new_request.get(), resource_type, |
| 2004 resource_context, | 2006 resource_context, |
| 2005 nullptr, // appcache_service | 2007 nullptr, // appcache_service |
| 2006 -1, // child_id | 2008 -1, // child_id |
| 2007 -1, // route_id | 2009 -1, // route_id |
| 2008 handler.Pass()); | 2010 handler.Pass()); |
| 2009 | 2011 |
| 2012 if (info.is_main_frame) |
| 2013 loader->AboutToBeginNavigation(TimeTicks::Now()); |
| 2014 |
| 2010 BeginRequestInternal(new_request.Pass(), handler.Pass()); | 2015 BeginRequestInternal(new_request.Pass(), handler.Pass()); |
| 2011 } | 2016 } |
| 2012 | 2017 |
| 2013 // static | 2018 // static |
| 2014 int ResourceDispatcherHostImpl::CalculateApproximateMemoryCost( | 2019 int ResourceDispatcherHostImpl::CalculateApproximateMemoryCost( |
| 2015 net::URLRequest* request) { | 2020 net::URLRequest* request) { |
| 2016 // The following fields should be a minor size contribution (experimentally | 2021 // The following fields should be a minor size contribution (experimentally |
| 2017 // on the order of 100). However since they are variable length, it could | 2022 // on the order of 100). However since they are variable length, it could |
| 2018 // in theory be a sizeable contribution. | 2023 // in theory be a sizeable contribution. |
| 2019 int strings_cost = request->extra_request_headers().ToString().size() + | 2024 int strings_cost = request->extra_request_headers().ToString().size() + |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2367 | 2372 |
| 2368 // Add a flag to selectively bypass the data reduction proxy if the resource | 2373 // Add a flag to selectively bypass the data reduction proxy if the resource |
| 2369 // type is not an image. | 2374 // type is not an image. |
| 2370 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) | 2375 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) |
| 2371 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; | 2376 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; |
| 2372 | 2377 |
| 2373 return load_flags; | 2378 return load_flags; |
| 2374 } | 2379 } |
| 2375 | 2380 |
| 2376 } // namespace content | 2381 } // namespace content |
| OLD | NEW |