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

Side by Side Diff: content/renderer/render_thread_impl.cc

Issue 189883009: Define a --force-gpu-rasterization flag (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor logic fix-up Created 6 years, 9 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
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_thread_impl.h" 5 #include "content/renderer/render_thread_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <map> 9 #include <map>
10 #include <vector> 10 #include <vector>
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 #include "third_party/WebKit/public/web/WebPopupMenu.h" 108 #include "third_party/WebKit/public/web/WebPopupMenu.h"
109 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" 109 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
110 #include "third_party/WebKit/public/web/WebScriptController.h" 110 #include "third_party/WebKit/public/web/WebScriptController.h"
111 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" 111 #include "third_party/WebKit/public/web/WebSecurityPolicy.h"
112 #include "third_party/WebKit/public/web/WebView.h" 112 #include "third_party/WebKit/public/web/WebView.h"
113 #include "third_party/skia/include/core/SkGraphics.h" 113 #include "third_party/skia/include/core/SkGraphics.h"
114 #include "ui/base/layout.h" 114 #include "ui/base/layout.h"
115 #include "ui/base/ui_base_switches.h" 115 #include "ui/base/ui_base_switches.h"
116 #include "v8/include/v8.h" 116 #include "v8/include/v8.h"
117 #include "webkit/renderer/compositor_bindings/web_external_bitmap_impl.h" 117 #include "webkit/renderer/compositor_bindings/web_external_bitmap_impl.h"
118 #include "webkit/renderer/compositor_bindings/web_layer_impl.h"
118 119
119 #if defined(OS_ANDROID) 120 #if defined(OS_ANDROID)
120 #include <cpu-features.h> 121 #include <cpu-features.h>
121 #include "content/renderer/android/synchronous_compositor_factory.h" 122 #include "content/renderer/android/synchronous_compositor_factory.h"
122 #include "content/renderer/media/android/renderer_demuxer_android.h" 123 #include "content/renderer/media/android/renderer_demuxer_android.h"
123 #endif 124 #endif
124 125
125 #if defined(OS_MACOSX) 126 #if defined(OS_MACOSX)
126 #include "content/renderer/webscrollbarbehavior_impl_mac.h" 127 #include "content/renderer/webscrollbarbehavior_impl_mac.h"
127 #endif 128 #endif
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 AddFilter((new EmbeddedWorkerContextMessageFilter())->GetFilter()); 385 AddFilter((new EmbeddedWorkerContextMessageFilter())->GetFilter());
385 386
386 GetContentClient()->renderer()->RenderThreadStarted(); 387 GetContentClient()->renderer()->RenderThreadStarted();
387 388
388 InitSkiaEventTracer(); 389 InitSkiaEventTracer();
389 390
390 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 391 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
391 if (command_line.HasSwitch(cc::switches::kEnableGpuBenchmarking)) 392 if (command_line.HasSwitch(cc::switches::kEnableGpuBenchmarking))
392 RegisterExtension(GpuBenchmarkingExtension::Get()); 393 RegisterExtension(GpuBenchmarkingExtension::Get());
393 394
395 is_impl_side_painting_enabled_ =
396 command_line.HasSwitch(switches::kEnableImplSidePainting) &&
397 !command_line.HasSwitch(switches::kDisableImplSidePainting);
398 webkit::WebLayerImpl::SetImplSidePaintingEnabled(
399 is_impl_side_painting_enabled_);
400
401 is_map_image_enabled_ =
402 command_line.HasSwitch(switches::kEnableMapImage) &&
403 !command_line.HasSwitch(switches::kDisableMapImage);
404
405 if (command_line.HasSwitch(switches::kDisableLCDText)) {
406 is_lcd_text_enabled_ = false;
407 } else if (command_line.HasSwitch(switches::kEnableLCDText)) {
408 is_lcd_text_enabled_ = true;
409 } else {
410 #if defined(OS_ANDROID)
411 is_lcd_text_enabled_ = false;
412 #else
413 is_lcd_text_enabled_ = true;
414 #endif
415 }
416
417 is_gpu_rasterization_enabled_ = false;
418 is_gpu_rasterization_forced_ = false;
419 if (is_impl_side_painting_enabled_ &&
420 !command_line.HasSwitch(switches::kDisableGpuRasterization)) {
421 if (command_line.HasSwitch(switches::kForceGpuRasterization)) {
422 is_gpu_rasterization_forced_ = true;
423 } else if (command_line.HasSwitch(switches::kEnableGpuRasterization) ||
424 command_line.HasSwitch(
425 switches::kEnableBleedingEdgeRenderingFastPaths)) {
426 is_gpu_rasterization_enabled_ = true;
427 }
428 }
429
394 // Note that under Linux, the media library will normally already have 430 // Note that under Linux, the media library will normally already have
395 // been initialized by the Zygote before this instance became a Renderer. 431 // been initialized by the Zygote before this instance became a Renderer.
396 base::FilePath media_path; 432 base::FilePath media_path;
397 PathService::Get(DIR_MEDIA_LIBS, &media_path); 433 PathService::Get(DIR_MEDIA_LIBS, &media_path);
398 if (!media_path.empty()) 434 if (!media_path.empty())
399 media::InitializeMediaLibrary(media_path); 435 media::InitializeMediaLibrary(media_path);
400 436
401 memory_pressure_listener_.reset(new base::MemoryPressureListener( 437 memory_pressure_listener_.reset(new base::MemoryPressureListener(
402 base::Bind(&RenderThreadImpl::OnMemoryPressure, base::Unretained(this)))); 438 base::Bind(&RenderThreadImpl::OnMemoryPressure, base::Unretained(this))));
403 439
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 webkit::SetSharedMemoryAllocationFunction(AllocateSharedMemoryFunction); 767 webkit::SetSharedMemoryAllocationFunction(AllocateSharedMemoryFunction);
732 768
733 // Limit use of the scaled image cache to when deferred image decoding 769 // Limit use of the scaled image cache to when deferred image decoding
734 // is enabled. 770 // is enabled.
735 // TODO(reveman): Allow use of this cache on Android once 771 // TODO(reveman): Allow use of this cache on Android once
736 // SkDiscardablePixelRef is used for decoded images. crbug.com/330041 772 // SkDiscardablePixelRef is used for decoded images. crbug.com/330041
737 bool use_skia_scaled_image_cache = false; 773 bool use_skia_scaled_image_cache = false;
738 #if !defined(OS_ANDROID) 774 #if !defined(OS_ANDROID)
739 use_skia_scaled_image_cache = 775 use_skia_scaled_image_cache =
740 command_line.HasSwitch(switches::kEnableDeferredImageDecoding) || 776 command_line.HasSwitch(switches::kEnableDeferredImageDecoding) ||
741 cc::switches::IsImplSidePaintingEnabled(); 777 is_impl_side_painting_enabled_;
742 #endif 778 #endif
743 if (!use_skia_scaled_image_cache) 779 if (!use_skia_scaled_image_cache)
744 SkGraphics::SetImageCacheByteLimit(0u); 780 SkGraphics::SetImageCacheByteLimit(0u);
745 } 781 }
746 782
747 void RenderThreadImpl::RegisterSchemes() { 783 void RenderThreadImpl::RegisterSchemes() {
748 // swappedout: pages should not be accessible, and should also 784 // swappedout: pages should not be accessible, and should also
749 // be treated as empty documents that can commit synchronously. 785 // be treated as empty documents that can commit synchronously.
750 WebString swappedout_scheme(base::ASCIIToUTF16(kSwappedOutScheme)); 786 WebString swappedout_scheme(base::ASCIIToUTF16(kSwappedOutScheme));
751 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(swappedout_scheme); 787 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(swappedout_scheme);
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
1418 hidden_widget_count_--; 1454 hidden_widget_count_--;
1419 1455
1420 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { 1456 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) {
1421 return; 1457 return;
1422 } 1458 }
1423 1459
1424 ScheduleIdleHandler(kLongIdleHandlerDelayMs); 1460 ScheduleIdleHandler(kLongIdleHandlerDelayMs);
1425 } 1461 }
1426 1462
1427 } // namespace content 1463 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698