| 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/renderer_blink_platform_impl.h" | 5 #include "content/renderer/renderer_blink_platform_impl.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 #include "content/child/webfileutilities_impl.h" | 36 #include "content/child/webfileutilities_impl.h" |
| 37 #include "content/child/webmessageportchannel_impl.h" | 37 #include "content/child/webmessageportchannel_impl.h" |
| 38 #include "content/common/file_utilities_messages.h" | 38 #include "content/common/file_utilities_messages.h" |
| 39 #include "content/common/frame_messages.h" | 39 #include "content/common/frame_messages.h" |
| 40 #include "content/common/gpu/client/context_provider_command_buffer.h" | 40 #include "content/common/gpu/client/context_provider_command_buffer.h" |
| 41 #include "content/common/gpu/client/gpu_channel_host.h" | 41 #include "content/common/gpu/client/gpu_channel_host.h" |
| 42 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 42 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
| 43 #include "content/common/gpu/gpu_process_launch_causes.h" | 43 #include "content/common/gpu/gpu_process_launch_causes.h" |
| 44 #include "content/common/mime_registry_messages.h" | 44 #include "content/common/mime_registry_messages.h" |
| 45 #include "content/common/render_process_messages.h" | 45 #include "content/common/render_process_messages.h" |
| 46 #include "content/common/view_messages.h" | |
| 47 #include "content/public/common/content_switches.h" | 46 #include "content/public/common/content_switches.h" |
| 48 #include "content/public/common/service_registry.h" | 47 #include "content/public/common/service_registry.h" |
| 49 #include "content/public/common/webplugininfo.h" | 48 #include "content/public/common/webplugininfo.h" |
| 50 #include "content/public/renderer/content_renderer_client.h" | 49 #include "content/public/renderer/content_renderer_client.h" |
| 51 #include "content/renderer/battery_status/battery_status_dispatcher.h" | 50 #include "content/renderer/battery_status/battery_status_dispatcher.h" |
| 52 #include "content/renderer/cache_storage/webserviceworkercachestorage_impl.h" | 51 #include "content/renderer/cache_storage/webserviceworkercachestorage_impl.h" |
| 53 #include "content/renderer/device_sensors/device_light_event_pump.h" | 52 #include "content/renderer/device_sensors/device_light_event_pump.h" |
| 54 #include "content/renderer/device_sensors/device_motion_event_pump.h" | 53 #include "content/renderer/device_sensors/device_motion_event_pump.h" |
| 55 #include "content/renderer/device_sensors/device_orientation_event_pump.h" | 54 #include "content/renderer/device_sensors/device_orientation_event_pump.h" |
| 56 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" | 55 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 } | 347 } |
| 349 | 348 |
| 350 void RendererBlinkPlatformImpl::cacheMetadata(const blink::WebURL& url, | 349 void RendererBlinkPlatformImpl::cacheMetadata(const blink::WebURL& url, |
| 351 int64 response_time, | 350 int64 response_time, |
| 352 const char* data, | 351 const char* data, |
| 353 size_t size) { | 352 size_t size) { |
| 354 // Let the browser know we generated cacheable metadata for this resource. The | 353 // Let the browser know we generated cacheable metadata for this resource. The |
| 355 // browser may cache it and return it on subsequent responses to speed | 354 // browser may cache it and return it on subsequent responses to speed |
| 356 // the processing of this resource. | 355 // the processing of this resource. |
| 357 std::vector<char> copy(data, data + size); | 356 std::vector<char> copy(data, data + size); |
| 358 RenderThread::Get()->Send(new ViewHostMsg_DidGenerateCacheableMetadata( | 357 RenderThread::Get()->Send( |
| 359 url, base::Time::FromInternalValue(response_time), copy)); | 358 new RenderProcessHostMsg_DidGenerateCacheableMetadata( |
| 359 url, base::Time::FromInternalValue(response_time), copy)); |
| 360 } | 360 } |
| 361 | 361 |
| 362 WebString RendererBlinkPlatformImpl::defaultLocale() { | 362 WebString RendererBlinkPlatformImpl::defaultLocale() { |
| 363 return base::ASCIIToUTF16(RenderThread::Get()->GetLocale()); | 363 return base::ASCIIToUTF16(RenderThread::Get()->GetLocale()); |
| 364 } | 364 } |
| 365 | 365 |
| 366 void RendererBlinkPlatformImpl::suddenTerminationChanged(bool enabled) { | 366 void RendererBlinkPlatformImpl::suddenTerminationChanged(bool enabled) { |
| 367 if (enabled) { | 367 if (enabled) { |
| 368 // We should not get more enables than disables, but we want it to be a | 368 // We should not get more enables than disables, but we want it to be a |
| 369 // non-fatal error if it does happen. | 369 // non-fatal error if it does happen. |
| 370 DCHECK_GT(sudden_termination_disables_, 0); | 370 DCHECK_GT(sudden_termination_disables_, 0); |
| 371 sudden_termination_disables_ = std::max(sudden_termination_disables_ - 1, | 371 sudden_termination_disables_ = std::max(sudden_termination_disables_ - 1, |
| 372 0); | 372 0); |
| 373 if (sudden_termination_disables_ != 0) | 373 if (sudden_termination_disables_ != 0) |
| 374 return; | 374 return; |
| 375 } else { | 375 } else { |
| 376 sudden_termination_disables_++; | 376 sudden_termination_disables_++; |
| 377 if (sudden_termination_disables_ != 1) | 377 if (sudden_termination_disables_ != 1) |
| 378 return; | 378 return; |
| 379 } | 379 } |
| 380 | 380 |
| 381 RenderThread* thread = RenderThread::Get(); | 381 RenderThread* thread = RenderThread::Get(); |
| 382 if (thread) // NULL in unittests. | 382 if (thread) // NULL in unittests. |
| 383 thread->Send(new ViewHostMsg_SuddenTerminationChanged(enabled)); | 383 thread->Send(new RenderProcessHostMsg_SuddenTerminationChanged(enabled)); |
| 384 } | 384 } |
| 385 | 385 |
| 386 WebStorageNamespace* RendererBlinkPlatformImpl::createLocalStorageNamespace() { | 386 WebStorageNamespace* RendererBlinkPlatformImpl::createLocalStorageNamespace() { |
| 387 return new WebStorageNamespaceImpl(); | 387 return new WebStorageNamespaceImpl(); |
| 388 } | 388 } |
| 389 | 389 |
| 390 | 390 |
| 391 //------------------------------------------------------------------------------ | 391 //------------------------------------------------------------------------------ |
| 392 | 392 |
| 393 WebIDBFactory* RendererBlinkPlatformImpl::idbFactory() { | 393 WebIDBFactory* RendererBlinkPlatformImpl::idbFactory() { |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 | 832 |
| 833 void RendererBlinkPlatformImpl::screenColorProfile( | 833 void RendererBlinkPlatformImpl::screenColorProfile( |
| 834 WebVector<char>* to_profile) { | 834 WebVector<char>* to_profile) { |
| 835 #if defined(OS_WIN) | 835 #if defined(OS_WIN) |
| 836 // On Windows screen color profile is only available in the browser. | 836 // On Windows screen color profile is only available in the browser. |
| 837 std::vector<char> profile; | 837 std::vector<char> profile; |
| 838 // This Send() can be called from any impl-side thread. Use a thread | 838 // This Send() can be called from any impl-side thread. Use a thread |
| 839 // safe send to avoid crashing trying to access RenderThread::Get(), | 839 // safe send to avoid crashing trying to access RenderThread::Get(), |
| 840 // which is not accessible from arbitrary threads. | 840 // which is not accessible from arbitrary threads. |
| 841 thread_safe_sender_->Send( | 841 thread_safe_sender_->Send( |
| 842 new ViewHostMsg_GetMonitorColorProfile(&profile)); | 842 new RenderProcessHostMsg_GetMonitorColorProfile(&profile)); |
| 843 *to_profile = profile; | 843 *to_profile = profile; |
| 844 #else | 844 #else |
| 845 // On other platforms, the primary monitor color profile can be read | 845 // On other platforms, the primary monitor color profile can be read |
| 846 // directly. | 846 // directly. |
| 847 gfx::ColorProfile profile; | 847 gfx::ColorProfile profile; |
| 848 *to_profile = profile.profile(); | 848 *to_profile = profile.profile(); |
| 849 #endif | 849 #endif |
| 850 } | 850 } |
| 851 | 851 |
| 852 //------------------------------------------------------------------------------ | 852 //------------------------------------------------------------------------------ |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 932 blink::WebSpeechSynthesizerClient* client) { | 932 blink::WebSpeechSynthesizerClient* client) { |
| 933 return GetContentClient()->renderer()->OverrideSpeechSynthesizer(client); | 933 return GetContentClient()->renderer()->OverrideSpeechSynthesizer(client); |
| 934 } | 934 } |
| 935 | 935 |
| 936 //------------------------------------------------------------------------------ | 936 //------------------------------------------------------------------------------ |
| 937 | 937 |
| 938 bool RendererBlinkPlatformImpl::processMemorySizesInBytes( | 938 bool RendererBlinkPlatformImpl::processMemorySizesInBytes( |
| 939 size_t* private_bytes, | 939 size_t* private_bytes, |
| 940 size_t* shared_bytes) { | 940 size_t* shared_bytes) { |
| 941 content::RenderThread::Get()->Send( | 941 content::RenderThread::Get()->Send( |
| 942 new ViewHostMsg_GetProcessMemorySizes(private_bytes, shared_bytes)); | 942 new RenderProcessHostMsg_GetProcessMemorySizes( |
| 943 private_bytes, shared_bytes)); |
| 943 return true; | 944 return true; |
| 944 } | 945 } |
| 945 | 946 |
| 946 //------------------------------------------------------------------------------ | 947 //------------------------------------------------------------------------------ |
| 947 | 948 |
| 948 blink::WebGraphicsContext3D* | 949 blink::WebGraphicsContext3D* |
| 949 RendererBlinkPlatformImpl::createOffscreenGraphicsContext3D( | 950 RendererBlinkPlatformImpl::createOffscreenGraphicsContext3D( |
| 950 const blink::WebGraphicsContext3D::Attributes& attributes) { | 951 const blink::WebGraphicsContext3D::Attributes& attributes) { |
| 951 return createOffscreenGraphicsContext3D(attributes, NULL); | 952 return createOffscreenGraphicsContext3D(attributes, NULL); |
| 952 } | 953 } |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1256 //------------------------------------------------------------------------------ | 1257 //------------------------------------------------------------------------------ |
| 1257 | 1258 |
| 1258 void RendererBlinkPlatformImpl::MockBatteryStatusChangedForTesting( | 1259 void RendererBlinkPlatformImpl::MockBatteryStatusChangedForTesting( |
| 1259 const blink::WebBatteryStatus& status) { | 1260 const blink::WebBatteryStatus& status) { |
| 1260 if (!g_test_battery_status_listener) | 1261 if (!g_test_battery_status_listener) |
| 1261 return; | 1262 return; |
| 1262 g_test_battery_status_listener->updateBatteryStatus(status); | 1263 g_test_battery_status_listener->updateBatteryStatus(status); |
| 1263 } | 1264 } |
| 1264 | 1265 |
| 1265 } // namespace content | 1266 } // namespace content |
| OLD | NEW |