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

Side by Side Diff: content/browser/frame_host/navigator_impl.cc

Issue 2661743002: PlzNavigate: Invoke didStartProvisionalLoad() when the renderer initiates a navigation in startLoad( (Closed)
Patch Set: Remove CHECK for redirect chain as the redirects may not be populated for provisional loads for ren… Created 3 years, 10 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/frame_host/navigator_impl.h" 5 #include "content/browser/frame_host/navigator_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1236 NavigationHandleImpl* navigation_handle) { 1236 NavigationHandleImpl* navigation_handle) {
1237 // If there is no browser-initiated pending entry for this navigation and it 1237 // If there is no browser-initiated pending entry for this navigation and it
1238 // is not for the error URL, create a pending entry using the current 1238 // is not for the error URL, create a pending entry using the current
1239 // SiteInstance, and ensure the address bar updates accordingly. We don't 1239 // SiteInstance, and ensure the address bar updates accordingly. We don't
1240 // know the referrer or extra headers at this point, but the referrer will 1240 // know the referrer or extra headers at this point, but the referrer will
1241 // be set properly upon commit. 1241 // be set properly upon commit.
1242 NavigationEntryImpl* pending_entry = controller_->GetPendingEntry(); 1242 NavigationEntryImpl* pending_entry = controller_->GetPendingEntry();
1243 bool has_browser_initiated_pending_entry = 1243 bool has_browser_initiated_pending_entry =
1244 pending_entry && !pending_entry->is_renderer_initiated(); 1244 pending_entry && !pending_entry->is_renderer_initiated();
1245 1245
1246 // PlzNavigate
1247 // A pending navigation entry is created in OnBeginNavigation(). The renderer
1248 // sends a provisional load notification after that. We don't want to create
1249 // a duplicate navigation entry here.
1250 bool renderer_provisional_load_to_pending_url =
1251 pending_entry && pending_entry->is_renderer_initiated() &&
1252 (pending_entry->GetURL() == url);
1253
1246 // If there is a transient entry, creating a new pending entry will result 1254 // If there is a transient entry, creating a new pending entry will result
1247 // in deleting it, which leads to inconsistent state. 1255 // in deleting it, which leads to inconsistent state.
1248 bool has_transient_entry = !!controller_->GetTransientEntry(); 1256 bool has_transient_entry = !!controller_->GetTransientEntry();
1249 1257
1250 if (!has_browser_initiated_pending_entry && !has_transient_entry) { 1258 if (!has_browser_initiated_pending_entry && !has_transient_entry &&
1259 !renderer_provisional_load_to_pending_url) {
1251 std::unique_ptr<NavigationEntryImpl> entry = 1260 std::unique_ptr<NavigationEntryImpl> entry =
1252 NavigationEntryImpl::FromNavigationEntry( 1261 NavigationEntryImpl::FromNavigationEntry(
1253 controller_->CreateNavigationEntry( 1262 controller_->CreateNavigationEntry(
1254 url, content::Referrer(), ui::PAGE_TRANSITION_LINK, 1263 url, content::Referrer(), ui::PAGE_TRANSITION_LINK,
1255 true /* is_renderer_initiated */, std::string(), 1264 true /* is_renderer_initiated */, std::string(),
1256 controller_->GetBrowserContext())); 1265 controller_->GetBrowserContext()));
1257 entry->set_site_instance(site_instance); 1266 entry->set_site_instance(site_instance);
1258 // TODO(creis): If there's a pending entry already, find a safe way to 1267 // TODO(creis): If there's a pending entry already, find a safe way to
1259 // update it instead of replacing it and copying over things like this. 1268 // update it instead of replacing it and copying over things like this.
1260 // That will allow us to skip the NavigationHandle update below as well. 1269 // That will allow us to skip the NavigationHandle update below as well.
(...skipping 10 matching lines...) Expand all
1271 if (navigation_handle) 1280 if (navigation_handle)
1272 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); 1281 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID());
1273 1282
1274 controller_->SetPendingEntry(std::move(entry)); 1283 controller_->SetPendingEntry(std::move(entry));
1275 if (delegate_) 1284 if (delegate_)
1276 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); 1285 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL);
1277 } 1286 }
1278 } 1287 }
1279 1288
1280 } // namespace content 1289 } // namespace content
OLDNEW
« no previous file with comments | « components/test_runner/web_frame_test_proxy.h ('k') | content/public/renderer/render_frame_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698