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

Side by Side Diff: content/common/navigation_params.cc

Issue 2424913003: Avoid unnecessary URL parsing for GURL comparisons in //content (Closed)
Patch Set: rebase on dependent PS Created 4 years, 2 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 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/common/navigation_params.h" 5 #include "content/common/navigation_params.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "content/common/service_worker/service_worker_types.h" 9 #include "content/common/service_worker/service_worker_types.h"
10 #include "content/public/common/browser_side_navigation_policy.h" 10 #include "content/public/common/browser_side_navigation_policy.h"
11 #include "content/public/common/url_constants.h" 11 #include "content/public/common/url_constants.h"
12 #include "url/gurl.h" 12 #include "url/gurl.h"
13 #include "url/url_constants.h" 13 #include "url/url_constants.h"
14 14
15 namespace content { 15 namespace content {
16 16
17 // PlzNavigate 17 // PlzNavigate
18 bool ShouldMakeNetworkRequestForURL(const GURL& url) { 18 bool ShouldMakeNetworkRequestForURL(const GURL& url) {
19 CHECK(IsBrowserSideNavigationEnabled()); 19 CHECK(IsBrowserSideNavigationEnabled());
20 20
21 // Javascript URLs, about:blank, srcdoc should not send a request 21 // Javascript URLs, about:blank, srcdoc should not send a request
22 // to the network stack. 22 // to the network stack.
23 // TODO(clamy): same document navigations should not send requests to the 23 // TODO(clamy): same document navigations should not send requests to the
24 // network stack. Neither should pushState/popState. 24 // network stack. Neither should pushState/popState.
25 return url != GURL(url::kAboutBlankURL) && 25 return url != url::kAboutBlankURL && !url.SchemeIs(url::kJavaScriptScheme) &&
26 !url.SchemeIs(url::kJavaScriptScheme) && !url.is_empty() && 26 !url.is_empty() && !url.SchemeIs(url::kContentIDScheme) &&
27 !url.SchemeIs(url::kContentIDScheme) && 27 url != content::kAboutSrcDocURL;
28 url != GURL(content::kAboutSrcDocURL);
29 } 28 }
30 29
31 CommonNavigationParams::CommonNavigationParams() 30 CommonNavigationParams::CommonNavigationParams()
32 : transition(ui::PAGE_TRANSITION_LINK), 31 : transition(ui::PAGE_TRANSITION_LINK),
33 navigation_type(FrameMsg_Navigate_Type::NORMAL), 32 navigation_type(FrameMsg_Navigate_Type::NORMAL),
34 allow_download(true), 33 allow_download(true),
35 should_replace_current_entry(false), 34 should_replace_current_entry(false),
36 report_type(FrameMsg_UILoadMetricsReportType::NO_REPORT), 35 report_type(FrameMsg_UILoadMetricsReportType::NO_REPORT),
37 lofi_state(LOFI_UNSPECIFIED), 36 lofi_state(LOFI_UNSPECIFIED),
38 navigation_start(base::TimeTicks::Now()), 37 navigation_start(base::TimeTicks::Now()),
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 const RequestNavigationParams& request_params) 188 const RequestNavigationParams& request_params)
190 : common_params(common_params), 189 : common_params(common_params),
191 start_params(start_params), 190 start_params(start_params),
192 request_params(request_params) { 191 request_params(request_params) {
193 } 192 }
194 193
195 NavigationParams::~NavigationParams() { 194 NavigationParams::~NavigationParams() {
196 } 195 }
197 196
198 } // namespace content 197 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698