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

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 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after
1598 // 1601 //
1599 // TODO(alexmos): This works fine for regular origins but may break path 1602 // TODO(alexmos): This works fine for regular origins but may break path
1600 // matching for file URLs with OOP subframes that open popups. This should 1603 // matching for file URLs with OOP subframes that open popups. This should
1601 // be fixed by either moving this lookup to the browser process or removing 1604 // be fixed by either moving this lookup to the browser process or removing
1602 // path-based matching for file URLs from content settings. See 1605 // path-based matching for file URLs from content settings. See
1603 // https://crbug.com/466297. 1606 // https://crbug.com/466297.
1604 if (creator->top()->isWebLocalFrame()) { 1607 if (creator->top()->isWebLocalFrame()) {
1605 params.opener_top_level_frame_url = creator->top()->document().url(); 1608 params.opener_top_level_frame_url = creator->top()->document().url();
1606 } else { 1609 } else {
1607 params.opener_top_level_frame_url = 1610 params.opener_top_level_frame_url =
1608 GURL(creator->top()->securityOrigin().toString()); 1611 blink::WebStringToGURL(creator->top()->securityOrigin().toString());
1609 } 1612 }
1610 1613
1611 GURL security_url(creator->document().securityOrigin().toString()); 1614 GURL security_url(blink::WebStringToGURL(
1615 creator->document().securityOrigin().toString()));
1612 if (!security_url.is_valid()) 1616 if (!security_url.is_valid())
1613 security_url = GURL(); 1617 security_url = GURL();
1614 params.opener_security_origin = security_url; 1618 params.opener_security_origin = security_url;
1615 params.opener_suppressed = suppress_opener; 1619 params.opener_suppressed = suppress_opener;
1616 params.disposition = NavigationPolicyToDisposition(policy); 1620 params.disposition = NavigationPolicyToDisposition(policy);
1617 if (!request.isNull()) { 1621 if (!request.isNull()) {
1618 params.target_url = request.url(); 1622 params.target_url = request.url();
1619 params.referrer = GetReferrerFromRequest(creator, request); 1623 params.referrer = GetReferrerFromRequest(creator, request);
1620 } 1624 }
1621 params.features = features; 1625 params.features = features;
(...skipping 2099 matching lines...) Expand 10 before | Expand all | Expand 10 after
3721 if (IsUseZoomForDSFEnabled()) { 3725 if (IsUseZoomForDSFEnabled()) {
3722 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); 3726 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_);
3723 } else { 3727 } else {
3724 webview()->setDeviceScaleFactor(device_scale_factor_); 3728 webview()->setDeviceScaleFactor(device_scale_factor_);
3725 } 3729 }
3726 webview()->settings()->setPreferCompositingToLCDTextEnabled( 3730 webview()->settings()->setPreferCompositingToLCDTextEnabled(
3727 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); 3731 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_));
3728 } 3732 }
3729 3733
3730 } // namespace content 3734 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_frame_proxy.cc ('k') | content/renderer/renderer_blink_platform_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698