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

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

Issue 181063022: cc: Trigger GPU rasterization based on a per-layer hint (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move flags to RenderThreadImpl 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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 AddFilter((new EmbeddedWorkerContextMessageFilter())->GetFilter()); 384 AddFilter((new EmbeddedWorkerContextMessageFilter())->GetFilter());
385 385
386 GetContentClient()->renderer()->RenderThreadStarted(); 386 GetContentClient()->renderer()->RenderThreadStarted();
387 387
388 InitSkiaEventTracer(); 388 InitSkiaEventTracer();
389 389
390 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 390 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
391 if (command_line.HasSwitch(cc::switches::kEnableGpuBenchmarking)) 391 if (command_line.HasSwitch(cc::switches::kEnableGpuBenchmarking))
392 RegisterExtension(GpuBenchmarkingExtension::Get()); 392 RegisterExtension(GpuBenchmarkingExtension::Get());
393 393
394 is_impl_side_painting_enabled_ =
395 command_line.HasSwitch(switches::kEnableImplSidePainting) &&
396 !command_line.HasSwitch(switches::kDisableImplSidePainting);
397
398 is_map_image_enabled_ =
399 command_line.HasSwitch(switches::kEnableMapImage) &&
400 !command_line.HasSwitch(switches::kDisableMapImage);
401
402 if (command_line.HasSwitch(switches::kDisableLCDText)) {
403 is_lcd_text_enabled_ = false;
404 } else if (command_line.HasSwitch(switches::kEnableLCDText)) {
405 is_lcd_text_enabled_ = true;
406 } else {
407 #if defined(OS_ANDROID)
408 is_lcd_text_enabled_ = false;
409 #else
410 is_lcd_text_enabled_ = true;
411 #endif
412 }
413
414 is_hybrid_rasterization_enabled_ = false;
415 is_gpu_rasterization_enabled_ = false;
416 if (is_impl_side_painting_enabled_) {
417 std::string rasterization_site =
418 command_line.GetSwitchValueASCII(switches::kRasterizationSite);
419 if (rasterization_site == "gpu" ||
420 command_line.HasSwitch(switches::kEnableBleedingEdgeRenderingFastPaths))
421 is_gpu_rasterization_enabled_ = true;
422 else if (rasterization_site == "hybrid")
423 is_hybrid_rasterization_enabled_ = true;
424 }
425
394 // Note that under Linux, the media library will normally already have 426 // Note that under Linux, the media library will normally already have
395 // been initialized by the Zygote before this instance became a Renderer. 427 // been initialized by the Zygote before this instance became a Renderer.
396 base::FilePath media_path; 428 base::FilePath media_path;
397 PathService::Get(DIR_MEDIA_LIBS, &media_path); 429 PathService::Get(DIR_MEDIA_LIBS, &media_path);
398 if (!media_path.empty()) 430 if (!media_path.empty())
399 media::InitializeMediaLibrary(media_path); 431 media::InitializeMediaLibrary(media_path);
400 432
401 memory_pressure_listener_.reset(new base::MemoryPressureListener( 433 memory_pressure_listener_.reset(new base::MemoryPressureListener(
402 base::Bind(&RenderThreadImpl::OnMemoryPressure, base::Unretained(this)))); 434 base::Bind(&RenderThreadImpl::OnMemoryPressure, base::Unretained(this))));
403 435
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 webkit::SetSharedMemoryAllocationFunction(AllocateSharedMemoryFunction); 763 webkit::SetSharedMemoryAllocationFunction(AllocateSharedMemoryFunction);
732 764
733 // Limit use of the scaled image cache to when deferred image decoding 765 // Limit use of the scaled image cache to when deferred image decoding
734 // is enabled. 766 // is enabled.
735 // TODO(reveman): Allow use of this cache on Android once 767 // TODO(reveman): Allow use of this cache on Android once
736 // SkDiscardablePixelRef is used for decoded images. crbug.com/330041 768 // SkDiscardablePixelRef is used for decoded images. crbug.com/330041
737 bool use_skia_scaled_image_cache = false; 769 bool use_skia_scaled_image_cache = false;
738 #if !defined(OS_ANDROID) 770 #if !defined(OS_ANDROID)
739 use_skia_scaled_image_cache = 771 use_skia_scaled_image_cache =
740 command_line.HasSwitch(switches::kEnableDeferredImageDecoding) || 772 command_line.HasSwitch(switches::kEnableDeferredImageDecoding) ||
741 cc::switches::IsImplSidePaintingEnabled(); 773 is_impl_side_painting_enabled_;
742 #endif 774 #endif
743 if (!use_skia_scaled_image_cache) 775 if (!use_skia_scaled_image_cache)
744 SkGraphics::SetImageCacheByteLimit(0u); 776 SkGraphics::SetImageCacheByteLimit(0u);
745 } 777 }
746 778
747 void RenderThreadImpl::RegisterSchemes() { 779 void RenderThreadImpl::RegisterSchemes() {
748 // swappedout: pages should not be accessible, and should also 780 // swappedout: pages should not be accessible, and should also
749 // be treated as empty documents that can commit synchronously. 781 // be treated as empty documents that can commit synchronously.
750 WebString swappedout_scheme(base::ASCIIToUTF16(kSwappedOutScheme)); 782 WebString swappedout_scheme(base::ASCIIToUTF16(kSwappedOutScheme));
751 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(swappedout_scheme); 783 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(swappedout_scheme);
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
1418 hidden_widget_count_--; 1450 hidden_widget_count_--;
1419 1451
1420 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { 1452 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) {
1421 return; 1453 return;
1422 } 1454 }
1423 1455
1424 ScheduleIdleHandler(kLongIdleHandlerDelayMs); 1456 ScheduleIdleHandler(kLongIdleHandlerDelayMs);
1425 } 1457 }
1426 1458
1427 } // namespace content 1459 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698