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

Unified Diff: chrome/renderer/content_settings_observer.cc

Issue 1568073002: Reduce string copies in GURL creation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/content_settings_observer.cc
diff --git a/chrome/renderer/content_settings_observer.cc b/chrome/renderer/content_settings_observer.cc
index f90a0cafa506ba8ab8bc5cf4caef1cc141ee12a6..5671aaf63bc1facfbd4a8e30c80c75e28fecfcda 100644
--- a/chrome/renderer/content_settings_observer.cc
+++ b/chrome/renderer/content_settings_observer.cc
@@ -11,6 +11,7 @@
#include "content/public/renderer/document_state.h"
#include "content/public/renderer/render_frame.h"
#include "content/public/renderer/render_view.h"
+#include "third_party/WebKit/public/platform/URLConversion.h"
#include "third_party/WebKit/public/platform/WebContentSettingCallbacks.h"
#include "third_party/WebKit/public/platform/WebURL.h"
#include "third_party/WebKit/public/web/WebDataSource.h"
@@ -99,7 +100,7 @@ GURL GetOriginOrURL(const WebFrame* frame) {
// URL is not replicated.
if (top_origin == "null")
return frame->top()->document().url();
- return GURL(top_origin);
+ return blink::WebStringToGURL(top_origin);
}
ContentSetting GetContentSettingFromRules(
@@ -260,9 +261,10 @@ bool ContentSettingsObserver::allowDatabase(const WebString& name,
bool result = false;
Send(new ChromeViewHostMsg_AllowDatabase(
- routing_id(), GURL(frame->securityOrigin().toString()),
- GURL(frame->top()->securityOrigin().toString()), name, display_name,
- &result));
+ routing_id(),
+ blink::WebStringToGURL(frame->securityOrigin().toString()),
+ blink::WebStringToGURL(frame->top()->securityOrigin().toString()),
+ name, display_name, &result));
return result;
}
@@ -285,8 +287,8 @@ void ContentSettingsObserver::requestFileSystemAccessAsync(
Send(new ChromeViewHostMsg_RequestFileSystemAccessAsync(
routing_id(), current_request_id_,
- GURL(frame->securityOrigin().toString()),
- GURL(frame->top()->securityOrigin().toString())));
+ blink::WebStringToGURL(frame->securityOrigin().toString()),
+ blink::WebStringToGURL(frame->top()->securityOrigin().toString())));
}
bool ContentSettingsObserver::allowImage(bool enabled_per_settings,
@@ -321,8 +323,10 @@ bool ContentSettingsObserver::allowIndexedDB(const WebString& name,
bool result = false;
Send(new ChromeViewHostMsg_AllowIndexedDB(
- routing_id(), GURL(frame->securityOrigin().toString()),
- GURL(frame->top()->securityOrigin().toString()), name, &result));
+ routing_id(),
+ blink::WebStringToGURL(frame->securityOrigin().toString()),
+ blink::WebStringToGURL(frame->top()->securityOrigin().toString()),
+ name, &result));
return result;
}
@@ -350,7 +354,8 @@ bool ContentSettingsObserver::allowScript(bool enabled_per_settings) {
ContentSetting setting = GetContentSettingFromRules(
content_setting_rules_->script_rules,
frame,
- GURL(frame->document().securityOrigin().toString()));
+ blink::WebStringToGURL(
+ frame->document().securityOrigin().toString()));
allow = setting != CONTENT_SETTING_BLOCK;
}
allow = allow || IsWhitelistedForContentSettings();
@@ -386,15 +391,18 @@ bool ContentSettingsObserver::allowStorage(bool local) {
bool result = false;
StoragePermissionsKey key(
- GURL(frame->document().securityOrigin().toString()), local);
+ blink::WebStringToGURL(frame->document().securityOrigin().toString()),
+ local);
std::map<StoragePermissionsKey, bool>::const_iterator permissions =
cached_storage_permissions_.find(key);
if (permissions != cached_storage_permissions_.end())
return permissions->second;
Send(new ChromeViewHostMsg_AllowDOMStorage(
- routing_id(), GURL(frame->securityOrigin().toString()),
- GURL(frame->top()->securityOrigin().toString()), local, &result));
+ routing_id(),
+ blink::WebStringToGURL(frame->securityOrigin().toString()),
+ blink::WebStringToGURL(frame->top()->securityOrigin().toString()),
+ local, &result));
cached_storage_permissions_[key] = result;
return result;
}
@@ -486,7 +494,7 @@ void ContentSettingsObserver::didUseKeygen() {
WebFrame* frame = render_frame()->GetWebFrame();
Send(new ChromeViewHostMsg_DidUseKeygen(
routing_id(),
- GURL(frame->securityOrigin().toString())));
+ blink::WebStringToGURL(frame->securityOrigin().toString())));
}
void ContentSettingsObserver::didNotAllowPlugins() {
« no previous file with comments | « chrome/renderer/chrome_content_renderer_client.cc ('k') | chrome/renderer/extensions/media_galleries_custom_bindings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698