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

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 10386213: Add command line flags for compositor's default tile size and (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | content/common/view_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/browser/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 entry.transferred_global_request_id().child_id; 222 entry.transferred_global_request_id().child_id;
223 params->transferred_request_request_id = 223 params->transferred_request_request_id =
224 entry.transferred_global_request_id().request_id; 224 entry.transferred_global_request_id().request_id;
225 // Avoid downloading when in view-source mode. 225 // Avoid downloading when in view-source mode.
226 params->allow_download = !entry.IsViewSourceMode(); 226 params->allow_download = !entry.IsViewSourceMode();
227 227
228 if (delegate) 228 if (delegate)
229 delegate->AddNavigationHeaders(params->url, &params->extra_headers); 229 delegate->AddNavigationHeaders(params->url, &params->extra_headers);
230 } 230 }
231 231
232 int GetSwitchValueInt(
darin (slow to review) 2012/05/18 20:20:17 nit: GetSwitchValueInt -> GetSwitchValueAsInt
233 const CommandLine& command_line,
234 const std::string& switch_string) {
235 std::string string_value = command_line.GetSwitchValueASCII(switch_string);
236 int int_value;
darin (slow to review) 2012/05/18 20:20:17 nit: initialize int_value? or, check the return v
237 base::StringToInt(string_value, &int_value);
238 return int_value;
239 }
240
232 } // namespace 241 } // namespace
233 242
234 namespace content { 243 namespace content {
235 244
236 WebContents* WebContents::Create( 245 WebContents* WebContents::Create(
237 BrowserContext* browser_context, 246 BrowserContext* browser_context,
238 SiteInstance* site_instance, 247 SiteInstance* site_instance,
239 int routing_id, 248 int routing_id,
240 const WebContents* base_web_contents, 249 const WebContents* base_web_contents,
241 SessionStorageNamespace* session_storage_namespace) { 250 SessionStorageNamespace* session_storage_namespace) {
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 gfx::Monitor monitor = gfx::Screen::GetMonitorNearestWindow( 537 gfx::Monitor monitor = gfx::Screen::GetMonitorNearestWindow(
529 rvh->GetView()->GetNativeView()); 538 rvh->GetView()->GetNativeView());
530 prefs.default_device_scale_factor = 539 prefs.default_device_scale_factor =
531 static_cast<int>(monitor.device_scale_factor()); 540 static_cast<int>(monitor.device_scale_factor());
532 } else { 541 } else {
533 prefs.default_device_scale_factor = 542 prefs.default_device_scale_factor =
534 gfx::Monitor::GetDefaultDeviceScaleFactor();; 543 gfx::Monitor::GetDefaultDeviceScaleFactor();;
535 } 544 }
536 #endif 545 #endif
537 546
547 if (command_line.HasSwitch(switches::kDefaultTileWidth))
548 prefs.default_tile_width = std::max(
549 1, GetSwitchValueInt(command_line, switches::kDefaultTileWidth));
darin (slow to review) 2012/05/18 20:20:17 nit: maybe the lower bound value should just be a
550 if (command_line.HasSwitch(switches::kDefaultTileHeight))
551 prefs.default_tile_height = std::max(
552 1, GetSwitchValueInt(command_line, switches::kDefaultTileHeight));
553 if (command_line.HasSwitch(switches::kMaxUntiledLayerWidth))
554 prefs.max_untiled_layer_width = std::max(
555 1, GetSwitchValueInt(command_line, switches::kMaxUntiledLayerWidth));
556 if (command_line.HasSwitch(switches::kMaxUntiledLayerHeight))
557 prefs.max_untiled_layer_height = std::max(
558 1, GetSwitchValueInt(command_line, switches::kMaxUntiledLayerHeight));
559
538 content::GetContentClient()->browser()->OverrideWebkitPrefs(rvh, url, &prefs); 560 content::GetContentClient()->browser()->OverrideWebkitPrefs(rvh, url, &prefs);
539 561
540 return prefs; 562 return prefs;
541 } 563 }
542 564
543 NavigationControllerImpl& WebContentsImpl::GetControllerImpl() { 565 NavigationControllerImpl& WebContentsImpl::GetControllerImpl() {
544 return controller_; 566 return controller_;
545 } 567 }
546 568
547 RenderViewHostManager* WebContentsImpl::GetRenderManagerForTesting() { 569 RenderViewHostManager* WebContentsImpl::GetRenderManagerForTesting() {
(...skipping 2235 matching lines...) Expand 10 before | Expand all | Expand 10 after
2783 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { 2805 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) {
2784 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); 2806 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh);
2785 // Can be NULL during tests. 2807 // Can be NULL during tests.
2786 if (rwh_view) 2808 if (rwh_view)
2787 rwh_view->SetSize(GetView()->GetContainerSize()); 2809 rwh_view->SetSize(GetView()->GetContainerSize());
2788 } 2810 }
2789 2811
2790 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { 2812 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() {
2791 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); 2813 return static_cast<RenderViewHostImpl*>(GetRenderViewHost());
2792 } 2814 }
OLDNEW
« no previous file with comments | « no previous file | content/common/view_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698