| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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_hybrid_rasterization_enabled_ = false; |
| 418 is_gpu_rasterization_enabled_ = false; |
| 419 if (is_impl_side_painting_enabled_) { |
| 420 std::string rasterization_site = |
| 421 command_line.GetSwitchValueASCII(switches::kRasterizationSite); |
| 422 if (rasterization_site == "gpu" || |
| 423 command_line.HasSwitch(switches::kEnableBleedingEdgeRenderingFastPaths)) |
| 424 is_gpu_rasterization_enabled_ = true; |
| 425 else if (rasterization_site == "hybrid") |
| 426 is_hybrid_rasterization_enabled_ = true; |
| 427 } |
| 428 |
| 394 // Note that under Linux, the media library will normally already have | 429 // Note that under Linux, the media library will normally already have |
| 395 // been initialized by the Zygote before this instance became a Renderer. | 430 // been initialized by the Zygote before this instance became a Renderer. |
| 396 base::FilePath media_path; | 431 base::FilePath media_path; |
| 397 PathService::Get(DIR_MEDIA_LIBS, &media_path); | 432 PathService::Get(DIR_MEDIA_LIBS, &media_path); |
| 398 if (!media_path.empty()) | 433 if (!media_path.empty()) |
| 399 media::InitializeMediaLibrary(media_path); | 434 media::InitializeMediaLibrary(media_path); |
| 400 | 435 |
| 401 memory_pressure_listener_.reset(new base::MemoryPressureListener( | 436 memory_pressure_listener_.reset(new base::MemoryPressureListener( |
| 402 base::Bind(&RenderThreadImpl::OnMemoryPressure, base::Unretained(this)))); | 437 base::Bind(&RenderThreadImpl::OnMemoryPressure, base::Unretained(this)))); |
| 403 | 438 |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 webkit::SetSharedMemoryAllocationFunction(AllocateSharedMemoryFunction); | 766 webkit::SetSharedMemoryAllocationFunction(AllocateSharedMemoryFunction); |
| 732 | 767 |
| 733 // Limit use of the scaled image cache to when deferred image decoding | 768 // Limit use of the scaled image cache to when deferred image decoding |
| 734 // is enabled. | 769 // is enabled. |
| 735 // TODO(reveman): Allow use of this cache on Android once | 770 // TODO(reveman): Allow use of this cache on Android once |
| 736 // SkDiscardablePixelRef is used for decoded images. crbug.com/330041 | 771 // SkDiscardablePixelRef is used for decoded images. crbug.com/330041 |
| 737 bool use_skia_scaled_image_cache = false; | 772 bool use_skia_scaled_image_cache = false; |
| 738 #if !defined(OS_ANDROID) | 773 #if !defined(OS_ANDROID) |
| 739 use_skia_scaled_image_cache = | 774 use_skia_scaled_image_cache = |
| 740 command_line.HasSwitch(switches::kEnableDeferredImageDecoding) || | 775 command_line.HasSwitch(switches::kEnableDeferredImageDecoding) || |
| 741 cc::switches::IsImplSidePaintingEnabled(); | 776 is_impl_side_painting_enabled_; |
| 742 #endif | 777 #endif |
| 743 if (!use_skia_scaled_image_cache) | 778 if (!use_skia_scaled_image_cache) |
| 744 SkGraphics::SetImageCacheByteLimit(0u); | 779 SkGraphics::SetImageCacheByteLimit(0u); |
| 745 } | 780 } |
| 746 | 781 |
| 747 void RenderThreadImpl::RegisterSchemes() { | 782 void RenderThreadImpl::RegisterSchemes() { |
| 748 // swappedout: pages should not be accessible, and should also | 783 // swappedout: pages should not be accessible, and should also |
| 749 // be treated as empty documents that can commit synchronously. | 784 // be treated as empty documents that can commit synchronously. |
| 750 WebString swappedout_scheme(base::ASCIIToUTF16(kSwappedOutScheme)); | 785 WebString swappedout_scheme(base::ASCIIToUTF16(kSwappedOutScheme)); |
| 751 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(swappedout_scheme); | 786 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(swappedout_scheme); |
| (...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1418 hidden_widget_count_--; | 1453 hidden_widget_count_--; |
| 1419 | 1454 |
| 1420 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { | 1455 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { |
| 1421 return; | 1456 return; |
| 1422 } | 1457 } |
| 1423 | 1458 |
| 1424 ScheduleIdleHandler(kLongIdleHandlerDelayMs); | 1459 ScheduleIdleHandler(kLongIdleHandlerDelayMs); |
| 1425 } | 1460 } |
| 1426 | 1461 |
| 1427 } // namespace content | 1462 } // namespace content |
| OLD | NEW |