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

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

Issue 2501343003: PlzNavigate: AppCache support. (Closed)
Patch Set: Address review comments Created 4 years 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/navigation_url_loader_impl.h" 5 #include "content/browser/loader/navigation_url_loader_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/trace_event/trace_event.h" 11 #include "base/trace_event/trace_event.h"
12 #include "content/browser/appcache/appcache_navigation_handle.h"
13 #include "content/browser/appcache/appcache_navigation_handle_core.h"
12 #include "content/browser/frame_host/navigation_request_info.h" 14 #include "content/browser/frame_host/navigation_request_info.h"
13 #include "content/browser/loader/navigation_url_loader_delegate.h" 15 #include "content/browser/loader/navigation_url_loader_delegate.h"
14 #include "content/browser/loader/navigation_url_loader_impl_core.h" 16 #include "content/browser/loader/navigation_url_loader_impl_core.h"
15 #include "content/browser/service_worker/service_worker_navigation_handle.h" 17 #include "content/browser/service_worker/service_worker_navigation_handle.h"
16 #include "content/public/browser/browser_context.h" 18 #include "content/public/browser/browser_context.h"
17 #include "content/public/browser/browser_thread.h" 19 #include "content/public/browser/browser_thread.h"
18 #include "content/public/browser/navigation_data.h" 20 #include "content/public/browser/navigation_data.h"
19 #include "content/public/browser/navigation_ui_data.h" 21 #include "content/public/browser/navigation_ui_data.h"
20 #include "content/public/browser/stream_handle.h" 22 #include "content/public/browser/stream_handle.h"
21 23
22 namespace content { 24 namespace content {
23 25
24 NavigationURLLoaderImpl::NavigationURLLoaderImpl( 26 NavigationURLLoaderImpl::NavigationURLLoaderImpl(
25 BrowserContext* browser_context, 27 BrowserContext* browser_context,
26 std::unique_ptr<NavigationRequestInfo> request_info, 28 std::unique_ptr<NavigationRequestInfo> request_info,
27 std::unique_ptr<NavigationUIData> navigation_ui_data, 29 std::unique_ptr<NavigationUIData> navigation_ui_data,
28 ServiceWorkerNavigationHandle* service_worker_handle, 30 ServiceWorkerNavigationHandle* service_worker_handle,
31 AppCacheNavigationHandle* appcache_handle,
29 NavigationURLLoaderDelegate* delegate) 32 NavigationURLLoaderDelegate* delegate)
30 : delegate_(delegate), weak_factory_(this) { 33 : delegate_(delegate), weak_factory_(this) {
31 DCHECK_CURRENTLY_ON(BrowserThread::UI); 34 DCHECK_CURRENTLY_ON(BrowserThread::UI);
32 35
33 core_ = new NavigationURLLoaderImplCore(weak_factory_.GetWeakPtr()); 36 core_ = new NavigationURLLoaderImplCore(weak_factory_.GetWeakPtr());
34 37
35 // TODO(carlosk): extend this trace to support non-PlzNavigate navigations. 38 // TODO(carlosk): extend this trace to support non-PlzNavigate navigations.
36 // For the trace below we're using the NavigationURLLoaderImplCore as the 39 // For the trace below we're using the NavigationURLLoaderImplCore as the
37 // async trace id, |navigation_start| as the timestamp and reporting the 40 // async trace id, |navigation_start| as the timestamp and reporting the
38 // FrameTreeNode id as a parameter. 41 // FrameTreeNode id as a parameter.
39 TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP1( 42 TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP1(
40 "navigation", "Navigation timeToResponseStarted", core_, 43 "navigation", "Navigation timeToResponseStarted", core_,
41 request_info->common_params.navigation_start, 44 request_info->common_params.navigation_start,
42 "FrameTreeNode id", request_info->frame_tree_node_id); 45 "FrameTreeNode id", request_info->frame_tree_node_id);
43 ServiceWorkerNavigationHandleCore* service_worker_handle_core = 46 ServiceWorkerNavigationHandleCore* service_worker_handle_core =
44 service_worker_handle ? service_worker_handle->core() : nullptr; 47 service_worker_handle ? service_worker_handle->core() : nullptr;
48 AppCacheNavigationHandleCore* appcache_handle_core =
49 appcache_handle ? appcache_handle->core() : nullptr;
45 BrowserThread::PostTask( 50 BrowserThread::PostTask(
46 BrowserThread::IO, FROM_HERE, 51 BrowserThread::IO, FROM_HERE,
47 base::Bind(&NavigationURLLoaderImplCore::Start, base::Unretained(core_), 52 base::Bind(&NavigationURLLoaderImplCore::Start, base::Unretained(core_),
48 browser_context->GetResourceContext(), 53 browser_context->GetResourceContext(),
49 service_worker_handle_core, base::Passed(&request_info), 54 service_worker_handle_core,
55 appcache_handle_core,
56 base::Passed(&request_info),
50 base::Passed(&navigation_ui_data))); 57 base::Passed(&navigation_ui_data)));
51 } 58 }
52 59
53 NavigationURLLoaderImpl::~NavigationURLLoaderImpl() { 60 NavigationURLLoaderImpl::~NavigationURLLoaderImpl() {
54 DCHECK_CURRENTLY_ON(BrowserThread::UI); 61 DCHECK_CURRENTLY_ON(BrowserThread::UI);
55 62
56 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, core_); 63 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, core_);
57 core_ = nullptr; 64 core_ = nullptr;
58 } 65 }
59 66
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 delegate_->OnRequestFailed(in_cache, net_error); 108 delegate_->OnRequestFailed(in_cache, net_error);
102 } 109 }
103 110
104 void NavigationURLLoaderImpl::NotifyRequestStarted(base::TimeTicks timestamp) { 111 void NavigationURLLoaderImpl::NotifyRequestStarted(base::TimeTicks timestamp) {
105 DCHECK_CURRENTLY_ON(BrowserThread::UI); 112 DCHECK_CURRENTLY_ON(BrowserThread::UI);
106 113
107 delegate_->OnRequestStarted(timestamp); 114 delegate_->OnRequestStarted(timestamp);
108 } 115 }
109 116
110 } // namespace content 117 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698