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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/memory/linked_ptr.h" | 12 #include "base/memory/linked_ptr.h" |
13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
15 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
16 #include "base/strings/utf_offset_string_conversions.h" | 16 #include "base/strings/utf_offset_string_conversions.h" |
17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
18 #include "base/time/time.h" | 18 #include "base/time/time.h" |
19 #include "cc/base/latency_info_swap_promise.h" | |
19 #include "cc/layers/texture_layer.h" | 20 #include "cc/layers/texture_layer.h" |
21 #include "cc/trees/layer_tree_host.h" | |
20 #include "content/common/content_constants_internal.h" | 22 #include "content/common/content_constants_internal.h" |
21 #include "content/public/common/content_switches.h" | 23 #include "content/public/common/content_switches.h" |
22 #include "content/public/common/page_zoom.h" | 24 #include "content/public/common/page_zoom.h" |
23 #include "content/public/renderer/content_renderer_client.h" | 25 #include "content/public/renderer/content_renderer_client.h" |
24 #include "content/renderer/pepper/common.h" | 26 #include "content/renderer/pepper/common.h" |
25 #include "content/renderer/pepper/content_decryptor_delegate.h" | 27 #include "content/renderer/pepper/content_decryptor_delegate.h" |
26 #include "content/renderer/pepper/event_conversion.h" | 28 #include "content/renderer/pepper/event_conversion.h" |
27 #include "content/renderer/pepper/fullscreen_container.h" | 29 #include "content/renderer/pepper/fullscreen_container.h" |
28 #include "content/renderer/pepper/gfx_conversion.h" | 30 #include "content/renderer/pepper/gfx_conversion.h" |
29 #include "content/renderer/pepper/host_dispatcher_wrapper.h" | 31 #include "content/renderer/pepper/host_dispatcher_wrapper.h" |
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1087 // event. This allows out-of-process plugins to respond to the user | 1089 // event. This allows out-of-process plugins to respond to the user |
1088 // gesture after processing has finished here. | 1090 // gesture after processing has finished here. |
1089 if (WebUserGestureIndicator::isProcessingUserGesture()) { | 1091 if (WebUserGestureIndicator::isProcessingUserGesture()) { |
1090 pending_user_gesture_ = | 1092 pending_user_gesture_ = |
1091 ppapi::EventTimeToPPTimeTicks(event.timeStampSeconds); | 1093 ppapi::EventTimeToPPTimeTicks(event.timeStampSeconds); |
1092 pending_user_gesture_token_ = | 1094 pending_user_gesture_token_ = |
1093 WebUserGestureIndicator::currentUserGestureToken(); | 1095 WebUserGestureIndicator::currentUserGestureToken(); |
1094 pending_user_gesture_token_.setOutOfProcess(); | 1096 pending_user_gesture_token_.setOutOfProcess(); |
1095 } | 1097 } |
1096 | 1098 |
1099 const ui::LatencyInfo* current_event_latency_info = NULL; | |
1100 if (render_frame_->GetRenderWidget()) { | |
1101 current_event_latency_info = | |
1102 render_frame_->GetRenderWidget()->current_event_latency_info(); | |
piman
2014/04/25 01:59:43
In the future (e.g. after the blink merge), I'm ho
Yufeng Shen (Slow to review)
2014/04/25 20:42:42
Right. I always want to couple WebInputEvent with
| |
1103 } | |
1104 | |
1097 // Each input event may generate more than one PP_InputEvent. | 1105 // Each input event may generate more than one PP_InputEvent. |
1098 for (size_t i = 0; i < events.size(); i++) { | 1106 for (size_t i = 0; i < events.size(); i++) { |
1107 if (current_event_latency_info) { | |
1108 events[i].latency_info.CopyLatencyFrom( | |
1109 *current_event_latency_info, | |
1110 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT); | |
1111 events[i].latency_info.CopyLatencyFrom( | |
1112 *current_event_latency_info, | |
1113 ui::INPUT_EVENT_LATENCY_UI_COMPONENT); | |
1114 } | |
1099 if (filtered_input_event_mask_ & event_class) | 1115 if (filtered_input_event_mask_ & event_class) |
1100 events[i].is_filtered = true; | 1116 events[i].is_filtered = true; |
1101 else | 1117 else |
1102 rv = true; // Unfiltered events are assumed to be handled. | 1118 rv = true; // Unfiltered events are assumed to be handled. |
1103 scoped_refptr<PPB_InputEvent_Shared> event_resource( | 1119 scoped_refptr<PPB_InputEvent_Shared> event_resource( |
1104 new PPB_InputEvent_Shared( | 1120 new PPB_InputEvent_Shared( |
1105 ppapi::OBJECT_IS_IMPL, pp_instance(), events[i])); | 1121 ppapi::OBJECT_IS_IMPL, pp_instance(), events[i])); |
1106 | 1122 |
1107 rv |= PP_ToBool(plugin_input_event_interface_->HandleInputEvent( | 1123 rv |= PP_ToBool(plugin_input_event_interface_->HandleInputEvent( |
1108 pp_instance(), event_resource->pp_resource())); | 1124 pp_instance(), event_resource->pp_resource())); |
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1976 scoped_ptr<cc::SingleReleaseCallback>* release_callback, | 1992 scoped_ptr<cc::SingleReleaseCallback>* release_callback, |
1977 bool use_shared_memory) { | 1993 bool use_shared_memory) { |
1978 if (!bound_graphics_2d_platform_) | 1994 if (!bound_graphics_2d_platform_) |
1979 return false; | 1995 return false; |
1980 return bound_graphics_2d_platform_->PrepareTextureMailbox(mailbox, | 1996 return bound_graphics_2d_platform_->PrepareTextureMailbox(mailbox, |
1981 release_callback); | 1997 release_callback); |
1982 } | 1998 } |
1983 | 1999 |
1984 void PepperPluginInstanceImpl::OnDestruct() { render_frame_ = NULL; } | 2000 void PepperPluginInstanceImpl::OnDestruct() { render_frame_ = NULL; } |
1985 | 2001 |
2002 void PepperPluginInstanceImpl::AddLatencyInfo( | |
2003 const std::vector<ui::LatencyInfo>& latency_info) { | |
2004 if (texture_layer_) { | |
2005 cc::LayerTreeHost* layer_tree_host = texture_layer_->layer_tree_host(); | |
piman
2014/04/25 01:59:43
I'd rather we went to the compositor via the Rende
Yufeng Shen (Slow to review)
2014/04/25 20:42:42
done.
It now goes through render_frame_->GetRender
| |
2006 if (layer_tree_host) { | |
2007 for (size_t i = 0; i < latency_info.size(); i++) { | |
2008 scoped_ptr<cc::SwapPromise> swap_promise( | |
2009 new cc::LatencyInfoSwapPromise(latency_info[i])); | |
2010 layer_tree_host->QueueSwapPromise(swap_promise.Pass()); | |
2011 } | |
2012 } | |
2013 } | |
2014 } | |
2015 | |
1986 void PepperPluginInstanceImpl::AddPluginObject(PluginObject* plugin_object) { | 2016 void PepperPluginInstanceImpl::AddPluginObject(PluginObject* plugin_object) { |
1987 DCHECK(live_plugin_objects_.find(plugin_object) == | 2017 DCHECK(live_plugin_objects_.find(plugin_object) == |
1988 live_plugin_objects_.end()); | 2018 live_plugin_objects_.end()); |
1989 live_plugin_objects_.insert(plugin_object); | 2019 live_plugin_objects_.insert(plugin_object); |
1990 } | 2020 } |
1991 | 2021 |
1992 void PepperPluginInstanceImpl::RemovePluginObject(PluginObject* plugin_object) { | 2022 void PepperPluginInstanceImpl::RemovePluginObject(PluginObject* plugin_object) { |
1993 // Don't actually verify that the object is in the set since during module | 2023 // Don't actually verify that the object is in the set since during module |
1994 // deletion we'll be in the process of freeing them. | 2024 // deletion we'll be in the process of freeing them. |
1995 live_plugin_objects_.erase(plugin_object); | 2025 live_plugin_objects_.erase(plugin_object); |
(...skipping 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3137 // Running out-of-process. Initiate an IPC call to notify the plugin | 3167 // Running out-of-process. Initiate an IPC call to notify the plugin |
3138 // process. | 3168 // process. |
3139 ppapi::proxy::HostDispatcher* dispatcher = | 3169 ppapi::proxy::HostDispatcher* dispatcher = |
3140 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); | 3170 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); |
3141 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( | 3171 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( |
3142 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); | 3172 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); |
3143 } | 3173 } |
3144 } | 3174 } |
3145 | 3175 |
3146 } // namespace content | 3176 } // namespace content |
OLD | NEW |