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

Side by Side Diff: chrome/renderer/worker_content_settings_client_proxy.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 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 "chrome/renderer/worker_content_settings_client_proxy.h" 5 #include "chrome/renderer/worker_content_settings_client_proxy.h"
6 6
7 #include "chrome/common/render_messages.h" 7 #include "chrome/common/render_messages.h"
8 #include "components/content_settings/content/common/content_settings_messages.h " 8 #include "components/content_settings/content/common/content_settings_messages.h "
9 #include "content/public/renderer/render_frame.h" 9 #include "content/public/renderer/render_frame.h"
10 #include "content/public/renderer/render_thread.h" 10 #include "content/public/renderer/render_thread.h"
11 #include "ipc/ipc_sync_message_filter.h" 11 #include "ipc/ipc_sync_message_filter.h"
12 #include "third_party/WebKit/public/platform/URLConversion.h"
12 #include "third_party/WebKit/public/web/WebDocument.h" 13 #include "third_party/WebKit/public/web/WebDocument.h"
13 #include "third_party/WebKit/public/web/WebFrame.h" 14 #include "third_party/WebKit/public/web/WebFrame.h"
14 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" 15 #include "third_party/WebKit/public/web/WebSecurityOrigin.h"
15 16
16 WorkerContentSettingsClientProxy::WorkerContentSettingsClientProxy( 17 WorkerContentSettingsClientProxy::WorkerContentSettingsClientProxy(
17 content::RenderFrame* render_frame, 18 content::RenderFrame* render_frame,
18 blink::WebFrame* frame) 19 blink::WebFrame* frame)
19 : routing_id_(render_frame->GetRoutingID()), 20 : routing_id_(render_frame->GetRoutingID()),
20 is_unique_origin_(false) { 21 is_unique_origin_(false) {
21 if (frame->document().securityOrigin().isUnique() || 22 if (frame->document().securityOrigin().isUnique() ||
22 frame->top()->securityOrigin().isUnique()) 23 frame->top()->securityOrigin().isUnique())
23 is_unique_origin_ = true; 24 is_unique_origin_ = true;
24 sync_message_filter_ = content::RenderThread::Get()->GetSyncMessageFilter(); 25 sync_message_filter_ = content::RenderThread::Get()->GetSyncMessageFilter();
25 document_origin_url_ = GURL(frame->document().securityOrigin().toString()); 26 document_origin_url_ =
26 top_frame_origin_url_ = GURL(frame->top()->securityOrigin().toString()); 27 blink::WebStringToGURL(frame->document().securityOrigin().toString());
28 top_frame_origin_url_ =
29 blink::WebStringToGURL(frame->top()->securityOrigin().toString());
27 } 30 }
28 31
29 WorkerContentSettingsClientProxy::~WorkerContentSettingsClientProxy() {} 32 WorkerContentSettingsClientProxy::~WorkerContentSettingsClientProxy() {}
30 33
31 bool WorkerContentSettingsClientProxy::allowDatabase( 34 bool WorkerContentSettingsClientProxy::allowDatabase(
32 const blink::WebString& name, 35 const blink::WebString& name,
33 const blink::WebString& display_name, 36 const blink::WebString& display_name,
34 unsigned long estimated_size) { 37 unsigned long estimated_size) {
35 if (is_unique_origin_) 38 if (is_unique_origin_)
36 return false; 39 return false;
(...skipping 18 matching lines...) Expand all
55 bool WorkerContentSettingsClientProxy::allowIndexedDB( 58 bool WorkerContentSettingsClientProxy::allowIndexedDB(
56 const blink::WebString& name) { 59 const blink::WebString& name) {
57 if (is_unique_origin_) 60 if (is_unique_origin_)
58 return false; 61 return false;
59 62
60 bool result = false; 63 bool result = false;
61 sync_message_filter_->Send(new ChromeViewHostMsg_AllowIndexedDB( 64 sync_message_filter_->Send(new ChromeViewHostMsg_AllowIndexedDB(
62 routing_id_, document_origin_url_, top_frame_origin_url_, name, &result)); 65 routing_id_, document_origin_url_, top_frame_origin_url_, name, &result));
63 return result; 66 return result;
64 } 67 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698