|
Reduce string copies in GURL creation
Converts GURL's constructor to take StringPieces instead of std::string to
avoid extra copies when converting from constants (which is fairly common).
Adds a WebStringToGURL helper function. The above change broke the ability
to give a WebString to GURL's constructor because that relied on the implicit
string16 conversion on WebString which will no longer match GURL.
This helper function will also eliminate a string copy for almost every
WebString to GURL conversion. Normally if a WebString contains a URL, it will
be ASCII. The old code would convert this ASCII to a temporary base::string16
just to pass into GURL, which can take either type (and will convert to
8-bit in the end either way).
This exposes the internal 8- and 16-bit buffers via new getters. This allows
the underlying buffers to be passed directly to GURL in the native format
without copying.
An alternative to exposing these getters would be to make the conversion
function a friend, or adding a GURL getter directly on WebString. But this
seems like the wrong type of function to have on a string class. There are a
number of other modules in Chrome that can take either 8 or 16 bit strings that
may be able to re-use this for performance-critical places.
The mojo implicit string conversion was similarly broken. In these cases, this
patch just adds a manual get() function call to retrieve the underlying
std::string rather than relying on the implicit conversion.
Media doesn't depend on content (where I put the helper function) and there
were only a few WebString -> GURL conversions there, so I did an explicit
string16 constructor for those (matching the current implicit behavior).
Committed: https://crrev.com/dfbcc3b7926990bbf5232112261f2ad9d8616e79
Cr-Commit-Position: refs/heads/master@{#370274}
Total comments: 2
Total comments: 2
Total comments: 1
Total comments: 9
Total comments: 4
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+243 lines, -121 lines) |
Patch |
 |
M |
chrome/browser/ui/webui/engagement/site_engagement_ui.cc
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
chrome/browser/ui/webui/omnibox/omnibox_ui_handler.cc
|
View
|
|
1 chunk |
+2 lines, -2 lines |
0 comments
|
Download
|
 |
M |
chrome/renderer/chrome_content_renderer_client.cc
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
2 chunks |
+3 lines, -2 lines |
0 comments
|
Download
|
 |
M |
chrome/renderer/content_settings_observer.cc
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
8 chunks |
+21 lines, -13 lines |
0 comments
|
Download
|
 |
M |
chrome/renderer/extensions/media_galleries_custom_bindings.cc
|
View
|
1
2
3
4
5
6
7
8
|
2 chunks |
+3 lines, -1 line |
0 comments
|
Download
|
 |
M |
chrome/renderer/extensions/resource_request_policy.cc
|
View
|
1
2
3
4
5
6
7
8
|
2 chunks |
+3 lines, -1 line |
0 comments
|
Download
|
 |
M |
chrome/renderer/page_load_histograms.cc
|
View
|
1
2
3
4
5
6
7
8
|
2 chunks |
+6 lines, -5 lines |
0 comments
|
Download
|
 |
M |
chrome/renderer/plugins/chrome_plugin_placeholder.cc
|
View
|
1
2
3
4
5
6
7
8
|
2 chunks |
+2 lines, -1 line |
0 comments
|
Download
|
 |
M |
chrome/renderer/prerender/prerender_dispatcher.cc
|
View
|
1
2
3
4
5
6
7
8
|
2 chunks |
+4 lines, -2 lines |
0 comments
|
Download
|
 |
M |
chrome/renderer/safe_browsing/phishing_dom_feature_extractor_browsertest.cc
|
View
|
1
2
3
4
5
6
7
8
|
2 chunks |
+2 lines, -1 line |
0 comments
|
Download
|
 |
M |
chrome/renderer/worker_content_settings_client_proxy.cc
|
View
|
1
2
3
4
5
6
7
8
|
2 chunks |
+5 lines, -2 lines |
0 comments
|
Download
|
 |
M |
components/autofill/content/renderer/form_autofill_util.cc
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
2 chunks |
+2 lines, -1 line |
0 comments
|
Download
|
 |
M |
components/html_viewer/blink_platform_impl.cc
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
2 chunks |
+3 lines, -2 lines |
0 comments
|
Download
|
 |
M |
components/html_viewer/html_document.cc
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
components/html_viewer/web_url_loader_impl.cc
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
5 chunks |
+5 lines, -5 lines |
0 comments
|
Download
|
 |
M |
components/web_view/frame.cc
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
components/web_view/pending_web_view_load.cc
|
View
|
1
2
3
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
content/browser/frame_host/frame_mojo_shell.cc
|
View
|
|
1 chunk |
+3 lines, -3 lines |
0 comments
|
Download
|
 |
M |
content/browser/navigator_connect/service_port_service_impl.cc
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
content/browser/permissions/permission_service_impl.cc
|
View
|
|
6 chunks |
+10 lines, -8 lines |
0 comments
|
Download
|
 |
M |
content/child/notifications/notification_data_conversions.cc
|
View
|
1
2
3
4
5
6
7
8
|
2 chunks |
+2 lines, -1 line |
0 comments
|
Download
|
 |
M |
content/child/notifications/notification_manager.cc
|
View
|
1
2
3
4
5
6
7
8
|
5 chunks |
+6 lines, -4 lines |
0 comments
|
Download
|
 |
M |
content/renderer/dom_storage/webstoragenamespace_impl.cc
|
View
|
1
2
3
4
5
6
7
8
|
2 chunks |
+2 lines, -1 line |
0 comments
|
Download
|
 |
M |
content/renderer/drop_data_builder.cc
|
View
|
1
2
3
4
5
6
7
8
|
2 chunks |
+2 lines, -1 line |
0 comments
|
Download
|
 |
M |
content/renderer/media/android/webmediaplayer_android.cc
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
4 chunks |
+7 lines, -4 lines |
0 comments
|
Download
|
 |
M |
content/renderer/media/cdm/pepper_cdm_wrapper_impl.cc
|
View
|
1
2
3
4
5
6
7
8
|
2 chunks |
+3 lines, -1 line |
0 comments
|
Download
|
 |
M |
content/renderer/media/user_media_client_impl.cc
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
3 chunks |
+7 lines, -3 lines |
0 comments
|
Download
|
 |
M |
content/renderer/pepper/pepper_plugin_instance_impl.cc
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
2 chunks |
+3 lines, -2 lines |
0 comments
|
Download
|
 |
M |
content/renderer/render_frame_impl.cc
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
7 chunks |
+9 lines, -7 lines |
0 comments
|
Download
|
 |
M |
content/renderer/render_frame_proxy.cc
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
2 chunks |
+3 lines, -1 line |
0 comments
|
Download
|
 |
M |
content/renderer/render_view_impl.cc
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
3 chunks |
+8 lines, -4 lines |
0 comments
|
Download
|
 |
M |
content/renderer/renderer_blink_platform_impl.cc
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
2 chunks |
+2 lines, -1 line |
0 comments
|
Download
|
 |
M |
content/renderer/service_worker/service_worker_context_client.cc
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
3 chunks |
+4 lines, -5 lines |
0 comments
|
Download
|
 |
M |
content/renderer/shared_worker/embedded_shared_worker_stub.cc
|
View
|
1
2
3
4
5
6
7
8
9
|
2 chunks |
+2 lines, -1 line |
0 comments
|
Download
|
 |
M |
content/test/weburl_loader_mock.cc
|
View
|
1
2
3
4
5
6
7
8
|
2 chunks |
+3 lines, -1 line |
0 comments
|
Download
|
 |
M |
mandoline/services/updater/updater_impl.cc
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
mandoline/ui/desktop_ui/browser_manager.cc
|
View
|
1
2
3
4
5
6
7
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
mandoline/ui/desktop_ui/browser_window.cc
|
View
|
1
2
3
4
5
6
7
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
media/blink/encrypted_media_player_support.cc
|
View
|
1
2
3
4
5
6
7
8
9
|
2 chunks |
+3 lines, -1 line |
0 comments
|
Download
|
 |
M |
media/blink/key_system_config_selector.cc
|
View
|
1
2
3
4
5
6
7
8
9
|
2 chunks |
+3 lines, -1 line |
0 comments
|
Download
|
 |
M |
media/blink/webcontentdecryptionmodule_impl.cc
|
View
|
1
2
3
4
5
6
7
8
9
|
2 chunks |
+3 lines, -1 line |
0 comments
|
Download
|
 |
M |
media/blink/webencryptedmediaclient_impl.cc
|
View
|
1
2
3
4
5
6
7
8
9
10
|
2 chunks |
+3 lines, -1 line |
0 comments
|
Download
|
 |
M |
media/blink/webmediaplayer_impl.cc
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
2 chunks |
+4 lines, -2 lines |
0 comments
|
Download
|
 |
M |
media/mojo/services/mojo_cdm.cc
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
media/mojo/services/mojo_cdm_service.cc
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
mojo/runner/android/android_handler.cc
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
mojo/services/network/url_loader_impl.cc
|
View
|
1
2
3
4
5
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
mojo/shell/application_instance.cc
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
mojo/shell/connect_to_application_params.cc
|
View
|
|
1 chunk |
+2 lines, -2 lines |
0 comments
|
Download
|
 |
M |
mojo/shell/fetcher/network_fetcher.cc
|
View
|
1
2
3
4
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
 |
M |
mojo/shell/package_manager/capability_filter_content_handler_unittest.cc
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
mojo/shell/package_manager/content_handler_unittest.cc
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
mojo/shell/package_manager/package_manager_impl.cc
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
mojo/shell/shell_application_delegate.cc
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
third_party/WebKit/Source/platform/BUILD.gn
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
|
2 chunks |
+3 lines, -0 lines |
0 comments
|
Download
|
 |
M |
third_party/WebKit/Source/platform/blink_platform.gyp
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
|
2 chunks |
+4 lines, -1 line |
0 comments
|
Download
|
 |
A |
third_party/WebKit/Source/platform/exported/URLConversion.cpp
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
1 chunk |
+30 lines, -0 lines |
0 comments
|
Download
|
 |
M |
third_party/WebKit/public/blink_headers.gypi
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
 |
A |
third_party/WebKit/public/platform/URLConversion.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
1 chunk |
+20 lines, -0 lines |
0 comments
|
Download
|
 |
M |
third_party/mozilla/BUILD.gn
|
View
|
1
2
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
 |
M |
third_party/mozilla/mozilla.gyp
|
View
|
1
2
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
 |
M |
url/gurl.h
|
View
|
|
2 chunks |
+4 lines, -3 lines |
0 comments
|
Download
|
 |
M |
url/gurl.cc
|
View
|
|
2 chunks |
+5 lines, -4 lines |
0 comments
|
Download
|
Total messages: 85 (29 generated)
|