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

Side by Side Diff: content/renderer/render_view_impl.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/renderer/render_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 #include "media/audio/audio_output_device.h" 102 #include "media/audio/audio_output_device.h"
103 #include "media/base/media_switches.h" 103 #include "media/base/media_switches.h"
104 #include "media/renderers/audio_renderer_impl.h" 104 #include "media/renderers/audio_renderer_impl.h"
105 #include "media/renderers/gpu_video_accelerator_factories.h" 105 #include "media/renderers/gpu_video_accelerator_factories.h"
106 #include "net/base/data_url.h" 106 #include "net/base/data_url.h"
107 #include "net/base/escape.h" 107 #include "net/base/escape.h"
108 #include "net/base/net_errors.h" 108 #include "net/base/net_errors.h"
109 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" 109 #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
110 #include "net/http/http_util.h" 110 #include "net/http/http_util.h"
111 #include "skia/ext/platform_canvas.h" 111 #include "skia/ext/platform_canvas.h"
112 #include "third_party/WebKit/public/platform/URLConversion.h"
112 #include "third_party/WebKit/public/platform/WebCString.h" 113 #include "third_party/WebKit/public/platform/WebCString.h"
113 #include "third_party/WebKit/public/platform/WebConnectionType.h" 114 #include "third_party/WebKit/public/platform/WebConnectionType.h"
114 #include "third_party/WebKit/public/platform/WebDragData.h" 115 #include "third_party/WebKit/public/platform/WebDragData.h"
115 #include "third_party/WebKit/public/platform/WebHTTPBody.h" 116 #include "third_party/WebKit/public/platform/WebHTTPBody.h"
116 #include "third_party/WebKit/public/platform/WebImage.h" 117 #include "third_party/WebKit/public/platform/WebImage.h"
117 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h" 118 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h"
118 #include "third_party/WebKit/public/platform/WebPoint.h" 119 #include "third_party/WebKit/public/platform/WebPoint.h"
119 #include "third_party/WebKit/public/platform/WebRect.h" 120 #include "third_party/WebKit/public/platform/WebRect.h"
120 #include "third_party/WebKit/public/platform/WebSize.h" 121 #include "third_party/WebKit/public/platform/WebSize.h"
121 #include "third_party/WebKit/public/platform/WebStorageQuotaCallbacks.h" 122 #include "third_party/WebKit/public/platform/WebStorageQuotaCallbacks.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 #endif 310 #endif
310 311
311 static RenderViewImpl* (*g_create_render_view_impl)( 312 static RenderViewImpl* (*g_create_render_view_impl)(
312 CompositorDependencies* compositor_deps, 313 CompositorDependencies* compositor_deps,
313 const ViewMsg_New_Params&) = nullptr; 314 const ViewMsg_New_Params&) = nullptr;
314 315
315 // static 316 // static
316 Referrer RenderViewImpl::GetReferrerFromRequest( 317 Referrer RenderViewImpl::GetReferrerFromRequest(
317 WebFrame* frame, 318 WebFrame* frame,
318 const WebURLRequest& request) { 319 const WebURLRequest& request) {
319 return Referrer(GURL(request.httpHeaderField(WebString::fromUTF8("Referer"))), 320 return Referrer(
320 request.referrerPolicy()); 321 blink::WebStringToGURL(request.httpHeaderField(
322 WebString::fromUTF8("Referer"))),
323 request.referrerPolicy());
321 } 324 }
322 325
323 // static 326 // static
324 WindowOpenDisposition RenderViewImpl::NavigationPolicyToDisposition( 327 WindowOpenDisposition RenderViewImpl::NavigationPolicyToDisposition(
325 WebNavigationPolicy policy) { 328 WebNavigationPolicy policy) {
326 switch (policy) { 329 switch (policy) {
327 case blink::WebNavigationPolicyIgnore: 330 case blink::WebNavigationPolicyIgnore:
328 return IGNORE_ACTION; 331 return IGNORE_ACTION;
329 case blink::WebNavigationPolicyDownload: 332 case blink::WebNavigationPolicyDownload:
330 return SAVE_TO_DISK; 333 return SAVE_TO_DISK;
(...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after
1599 // 1602 //
1600 // TODO(alexmos): This works fine for regular origins but may break path 1603 // TODO(alexmos): This works fine for regular origins but may break path
1601 // matching for file URLs with OOP subframes that open popups. This should 1604 // matching for file URLs with OOP subframes that open popups. This should
1602 // be fixed by either moving this lookup to the browser process or removing 1605 // be fixed by either moving this lookup to the browser process or removing
1603 // path-based matching for file URLs from content settings. See 1606 // path-based matching for file URLs from content settings. See
1604 // https://crbug.com/466297. 1607 // https://crbug.com/466297.
1605 if (creator->top()->isWebLocalFrame()) { 1608 if (creator->top()->isWebLocalFrame()) {
1606 params.opener_top_level_frame_url = creator->top()->document().url(); 1609 params.opener_top_level_frame_url = creator->top()->document().url();
1607 } else { 1610 } else {
1608 params.opener_top_level_frame_url = 1611 params.opener_top_level_frame_url =
1609 GURL(creator->top()->securityOrigin().toString()); 1612 blink::WebStringToGURL(creator->top()->securityOrigin().toString());
1610 } 1613 }
1611 1614
1612 GURL security_url(creator->document().securityOrigin().toString()); 1615 GURL security_url(blink::WebStringToGURL(
1616 creator->document().securityOrigin().toString()));
1613 if (!security_url.is_valid()) 1617 if (!security_url.is_valid())
1614 security_url = GURL(); 1618 security_url = GURL();
1615 params.opener_security_origin = security_url; 1619 params.opener_security_origin = security_url;
1616 params.opener_suppressed = suppress_opener; 1620 params.opener_suppressed = suppress_opener;
1617 params.disposition = NavigationPolicyToDisposition(policy); 1621 params.disposition = NavigationPolicyToDisposition(policy);
1618 if (!request.isNull()) { 1622 if (!request.isNull()) {
1619 params.target_url = request.url(); 1623 params.target_url = request.url();
1620 params.referrer = GetReferrerFromRequest(creator, request); 1624 params.referrer = GetReferrerFromRequest(creator, request);
1621 } 1625 }
1622 params.features = features; 1626 params.features = features;
(...skipping 2095 matching lines...) Expand 10 before | Expand all | Expand 10 after
3718 if (IsUseZoomForDSFEnabled()) { 3722 if (IsUseZoomForDSFEnabled()) {
3719 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); 3723 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_);
3720 } else { 3724 } else {
3721 webview()->setDeviceScaleFactor(device_scale_factor_); 3725 webview()->setDeviceScaleFactor(device_scale_factor_);
3722 } 3726 }
3723 webview()->settings()->setPreferCompositingToLCDTextEnabled( 3727 webview()->settings()->setPreferCompositingToLCDTextEnabled(
3724 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); 3728 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_));
3725 } 3729 }
3726 3730
3727 } // namespace content 3731 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698