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/pepper/pepper_plugin_instance_impl.h" | 5 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bit_cast.h" | 10 #include "base/bit_cast.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "base/threading/thread_task_runner_handle.h" | 21 #include "base/threading/thread_task_runner_handle.h" |
22 #include "base/time/time.h" | 22 #include "base/time/time.h" |
23 #include "base/trace_event/trace_event.h" | 23 #include "base/trace_event/trace_event.h" |
24 #include "build/build_config.h" | 24 #include "build/build_config.h" |
25 #include "cc/blink/web_layer_impl.h" | 25 #include "cc/blink/web_layer_impl.h" |
26 #include "cc/layers/texture_layer.h" | 26 #include "cc/layers/texture_layer.h" |
27 #include "content/common/content_constants_internal.h" | 27 #include "content/common/content_constants_internal.h" |
28 #include "content/common/frame_messages.h" | 28 #include "content/common/frame_messages.h" |
29 #include "content/public/common/content_constants.h" | 29 #include "content/public/common/content_constants.h" |
30 #include "content/public/renderer/content_renderer_client.h" | 30 #include "content/public/renderer/content_renderer_client.h" |
| 31 #include "content/renderer/media/audio_device_factory.h" |
31 #include "content/renderer/pepper/content_decryptor_delegate.h" | 32 #include "content/renderer/pepper/content_decryptor_delegate.h" |
32 #include "content/renderer/pepper/event_conversion.h" | 33 #include "content/renderer/pepper/event_conversion.h" |
33 #include "content/renderer/pepper/fullscreen_container.h" | 34 #include "content/renderer/pepper/fullscreen_container.h" |
34 #include "content/renderer/pepper/gfx_conversion.h" | 35 #include "content/renderer/pepper/gfx_conversion.h" |
35 #include "content/renderer/pepper/host_dispatcher_wrapper.h" | 36 #include "content/renderer/pepper/host_dispatcher_wrapper.h" |
36 #include "content/renderer/pepper/host_globals.h" | 37 #include "content/renderer/pepper/host_globals.h" |
37 #include "content/renderer/pepper/message_channel.h" | 38 #include "content/renderer/pepper/message_channel.h" |
38 #include "content/renderer/pepper/pepper_audio_controller.h" | 39 #include "content/renderer/pepper/pepper_audio_controller.h" |
39 #include "content/renderer/pepper/pepper_browser_connection.h" | 40 #include "content/renderer/pepper/pepper_browser_connection.h" |
40 #include "content/renderer/pepper/pepper_compositor_host.h" | 41 #include "content/renderer/pepper/pepper_compositor_host.h" |
(...skipping 12 matching lines...) Expand all Loading... |
53 #include "content/renderer/pepper/ppb_image_data_impl.h" | 54 #include "content/renderer/pepper/ppb_image_data_impl.h" |
54 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" | 55 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" |
55 #include "content/renderer/pepper/url_request_info_util.h" | 56 #include "content/renderer/pepper/url_request_info_util.h" |
56 #include "content/renderer/pepper/url_response_info_util.h" | 57 #include "content/renderer/pepper/url_response_info_util.h" |
57 #include "content/renderer/render_frame_impl.h" | 58 #include "content/renderer/render_frame_impl.h" |
58 #include "content/renderer/render_thread_impl.h" | 59 #include "content/renderer/render_thread_impl.h" |
59 #include "content/renderer/render_view_impl.h" | 60 #include "content/renderer/render_view_impl.h" |
60 #include "content/renderer/render_widget.h" | 61 #include "content/renderer/render_widget.h" |
61 #include "content/renderer/render_widget_fullscreen_pepper.h" | 62 #include "content/renderer/render_widget_fullscreen_pepper.h" |
62 #include "content/renderer/sad_plugin.h" | 63 #include "content/renderer/sad_plugin.h" |
63 #include "media/base/audio_hardware_config.h" | |
64 #include "ppapi/c/dev/ppp_text_input_dev.h" | 64 #include "ppapi/c/dev/ppp_text_input_dev.h" |
65 #include "ppapi/c/pp_rect.h" | 65 #include "ppapi/c/pp_rect.h" |
66 #include "ppapi/c/ppb_audio_config.h" | 66 #include "ppapi/c/ppb_audio_config.h" |
67 #include "ppapi/c/ppb_core.h" | 67 #include "ppapi/c/ppb_core.h" |
68 #include "ppapi/c/ppb_gamepad.h" | 68 #include "ppapi/c/ppb_gamepad.h" |
69 #include "ppapi/c/ppp_input_event.h" | 69 #include "ppapi/c/ppp_input_event.h" |
70 #include "ppapi/c/ppp_instance.h" | 70 #include "ppapi/c/ppp_instance.h" |
71 #include "ppapi/c/ppp_messaging.h" | 71 #include "ppapi/c/ppp_messaging.h" |
72 #include "ppapi/c/ppp_mouse_lock.h" | 72 #include "ppapi/c/ppp_mouse_lock.h" |
73 #include "ppapi/c/private/ppb_find_private.h" | 73 #include "ppapi/c/private/ppb_find_private.h" |
(...skipping 2372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2446 | 2446 |
2447 ScopedPPVar var_result = try_catch.FromV8(result); | 2447 ScopedPPVar var_result = try_catch.FromV8(result); |
2448 if (try_catch.HasException()) | 2448 if (try_catch.HasException()) |
2449 return PP_MakeUndefined(); | 2449 return PP_MakeUndefined(); |
2450 | 2450 |
2451 return var_result.Release(); | 2451 return var_result.Release(); |
2452 } | 2452 } |
2453 | 2453 |
2454 uint32_t PepperPluginInstanceImpl::GetAudioHardwareOutputSampleRate( | 2454 uint32_t PepperPluginInstanceImpl::GetAudioHardwareOutputSampleRate( |
2455 PP_Instance instance) { | 2455 PP_Instance instance) { |
2456 RenderThreadImpl* thread = RenderThreadImpl::current(); | 2456 return render_frame() |
2457 return thread->GetAudioHardwareConfig()->GetOutputSampleRate(); | 2457 ? AudioDeviceFactory::GetOutputDeviceInfo( |
| 2458 render_frame()->GetRoutingID(), 0 /* session_id */, |
| 2459 std::string() /* device_id */, url::Origin(document_url())) |
| 2460 .output_params() |
| 2461 .sample_rate() |
| 2462 : 0; |
2458 } | 2463 } |
2459 | 2464 |
2460 uint32_t PepperPluginInstanceImpl::GetAudioHardwareOutputBufferSize( | 2465 uint32_t PepperPluginInstanceImpl::GetAudioHardwareOutputBufferSize( |
2461 PP_Instance instance) { | 2466 PP_Instance instance) { |
2462 RenderThreadImpl* thread = RenderThreadImpl::current(); | 2467 return render_frame() |
2463 return thread->GetAudioHardwareConfig()->GetOutputBufferSize(); | 2468 ? AudioDeviceFactory::GetOutputDeviceInfo( |
| 2469 render_frame()->GetRoutingID(), 0 /* session_id */, |
| 2470 std::string() /* device_id */, url::Origin(document_url())) |
| 2471 .output_params() |
| 2472 .frames_per_buffer() |
| 2473 : 0; |
2464 } | 2474 } |
2465 | 2475 |
2466 PP_Var PepperPluginInstanceImpl::GetDefaultCharSet(PP_Instance instance) { | 2476 PP_Var PepperPluginInstanceImpl::GetDefaultCharSet(PP_Instance instance) { |
2467 if (!render_frame_) | 2477 if (!render_frame_) |
2468 return PP_MakeUndefined(); | 2478 return PP_MakeUndefined(); |
2469 return StringVar::StringToPPVar( | 2479 return StringVar::StringToPPVar( |
2470 render_frame_->render_view()->webkit_preferences().default_encoding); | 2480 render_frame_->render_view()->webkit_preferences().default_encoding); |
2471 } | 2481 } |
2472 | 2482 |
2473 // These PPB_ContentDecryptor_Private calls are responses to | 2483 // These PPB_ContentDecryptor_Private calls are responses to |
(...skipping 943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3417 const cc::TextureMailbox& mailbox) const { | 3427 const cc::TextureMailbox& mailbox) const { |
3418 auto it = | 3428 auto it = |
3419 std::find_if(texture_ref_counts_.begin(), texture_ref_counts_.end(), | 3429 std::find_if(texture_ref_counts_.begin(), texture_ref_counts_.end(), |
3420 [&mailbox](const TextureMailboxRefCount& ref_count) { | 3430 [&mailbox](const TextureMailboxRefCount& ref_count) { |
3421 return ref_count.first.mailbox() == mailbox.mailbox(); | 3431 return ref_count.first.mailbox() == mailbox.mailbox(); |
3422 }); | 3432 }); |
3423 return it != texture_ref_counts_.end(); | 3433 return it != texture_ref_counts_.end(); |
3424 } | 3434 } |
3425 | 3435 |
3426 } // namespace content | 3436 } // namespace content |
OLD | NEW |