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

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 2359723007: PlzNavigate: update navigation only if it took place. (Closed)
Patch Set: Created 4 years, 3 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 #include <iostream>
clamy 2016/09/23 15:35:38 Wrong place for include. Please put it just above
arthursonzogni 2016/09/26 08:30:32 Oops, I didn't have seen I left this debug-line he
1 // Copyright 2013 The Chromium Authors. All rights reserved. 2 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 3 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 4 // found in the LICENSE file.
4 5
5 #include "content/renderer/render_frame_impl.h" 6 #include "content/renderer/render_frame_impl.h"
6 7
7 #include <map> 8 #include <map>
8 #include <string> 9 #include <string>
9 #include <utility> 10 #include <utility>
10 #include <vector> 11 #include <vector>
(...skipping 3161 matching lines...) Expand 10 before | Expand all | Expand 10 after
3172 } 3173 }
3173 3174
3174 NavigationStateImpl* navigation_state = static_cast<NavigationStateImpl*>( 3175 NavigationStateImpl* navigation_state = static_cast<NavigationStateImpl*>(
3175 document_state->navigation_state()); 3176 document_state->navigation_state());
3176 3177
3177 // Set the navigation start time in blink. 3178 // Set the navigation start time in blink.
3178 datasource->setNavigationStartTime( 3179 datasource->setNavigationStartTime(
3179 ConvertToBlinkTime(navigation_state->common_params().navigation_start)); 3180 ConvertToBlinkTime(navigation_state->common_params().navigation_start));
3180 3181
3181 if (IsBrowserSideNavigationEnabled()) { 3182 if (IsBrowserSideNavigationEnabled()) {
3182 // Set timing of several events that happened during navigation. 3183 const NavigationTiming& timing =
3183 // They will be used in blink for the Navigation Timing API. 3184 navigation_state->request_params().navigation_timing;
3184 double redirect_start = ConvertToBlinkTime(
3185 navigation_state->request_params().navigation_timing.redirect_start);
3186 double redirect_end = ConvertToBlinkTime(
3187 navigation_state->request_params().navigation_timing.redirect_end);
3188 double fetch_start = ConvertToBlinkTime(
3189 navigation_state->request_params().navigation_timing.fetch_start);
3190 std::vector<GURL> redirectChain =
3191 navigation_state->request_params().redirects;
3192 redirectChain.push_back(navigation_state->common_params().url);
3193 3185
3194 datasource->updateNavigation(redirect_start, redirect_end, fetch_start, 3186 // Inform the datasource of what happened during the browser-side-navigation
3195 redirectChain); 3187 // only if the navigation actually took place.
3196 // TODO(clamy) We need to provide additional timing values for the 3188 if (!timing.fetch_start.is_null()) {
clamy 2016/09/23 15:35:38 I would find it a bit more readable if you just di
arthursonzogni 2016/09/26 08:30:32 Done.
3197 // Navigation Timing API to work with browser-side navigations. 3189 std::vector<GURL> redirectChain =
3198 // UnloadEventStart and UnloadEventEnd are still missing. 3190 navigation_state->request_params().redirects;
3191 redirectChain.push_back(navigation_state->common_params().url);
3192
3193 datasource->updateNavigation(ConvertToBlinkTime(timing.redirect_start),
3194 ConvertToBlinkTime(timing.redirect_end),
3195 ConvertToBlinkTime(timing.fetch_start),
3196 redirectChain);
3197 // TODO(clamy) We need to provide additional timing values for the
3198 // Navigation Timing API to work with browser-side navigations.
3199 // UnloadEventStart and UnloadEventEnd are still missing.
3200 }
3199 } 3201 }
3200 3202
3201 // Create the serviceworker's per-document network observing object if it 3203 // Create the serviceworker's per-document network observing object if it
3202 // does not exist (When navigation happens within a page, the provider already 3204 // does not exist (When navigation happens within a page, the provider already
3203 // exists). 3205 // exists).
3204 if (ServiceWorkerNetworkProvider::FromDocumentState( 3206 if (ServiceWorkerNetworkProvider::FromDocumentState(
3205 DocumentState::FromDataSource(datasource))) 3207 DocumentState::FromDataSource(datasource)))
3206 return; 3208 return;
3207 3209
3208 ServiceWorkerNetworkProvider::AttachToDocumentState( 3210 ServiceWorkerNetworkProvider::AttachToDocumentState(
(...skipping 3201 matching lines...) Expand 10 before | Expand all | Expand 10 after
6410 // event target. Potentially a Pepper plugin will receive the event. 6412 // event target. Potentially a Pepper plugin will receive the event.
6411 // In order to tell whether a plugin gets the last mouse event and which it 6413 // In order to tell whether a plugin gets the last mouse event and which it
6412 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6414 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6413 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6415 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6414 // |pepper_last_mouse_event_target_|. 6416 // |pepper_last_mouse_event_target_|.
6415 pepper_last_mouse_event_target_ = nullptr; 6417 pepper_last_mouse_event_target_ = nullptr;
6416 #endif 6418 #endif
6417 } 6419 }
6418 6420
6419 } // namespace content 6421 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698