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_graphics_2d_host.h" | 5 #include "content/renderer/pepper/pepper_graphics_2d_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
11 #include "cc/resources/shared_bitmap.h" | 11 #include "cc/resources/shared_bitmap.h" |
12 #include "cc/resources/texture_mailbox.h" | 12 #include "cc/resources/texture_mailbox.h" |
13 #include "content/child/child_shared_bitmap_manager.h" | 13 #include "content/child/child_shared_bitmap_manager.h" |
14 #include "content/public/renderer/render_thread.h" | 14 #include "content/public/renderer/render_thread.h" |
15 #include "content/public/renderer/renderer_ppapi_host.h" | 15 #include "content/public/renderer/renderer_ppapi_host.h" |
16 #include "content/renderer/pepper/gfx_conversion.h" | 16 #include "content/renderer/pepper/gfx_conversion.h" |
17 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" | 17 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
18 #include "content/renderer/pepper/pepper_plugin_instance_throttler.h" | 18 #include "content/renderer/pepper/plugin_instance_throttler_impl.h" |
19 #include "content/renderer/pepper/ppb_image_data_impl.h" | 19 #include "content/renderer/pepper/ppb_image_data_impl.h" |
20 #include "content/renderer/render_thread_impl.h" | 20 #include "content/renderer/render_thread_impl.h" |
21 #include "ppapi/c/pp_bool.h" | 21 #include "ppapi/c/pp_bool.h" |
22 #include "ppapi/c/pp_errors.h" | 22 #include "ppapi/c/pp_errors.h" |
23 #include "ppapi/c/pp_rect.h" | 23 #include "ppapi/c/pp_rect.h" |
24 #include "ppapi/c/pp_resource.h" | 24 #include "ppapi/c/pp_resource.h" |
25 #include "ppapi/host/dispatch_host_message.h" | 25 #include "ppapi/host/dispatch_host_message.h" |
26 #include "ppapi/host/host_message_context.h" | 26 #include "ppapi/host/host_message_context.h" |
27 #include "ppapi/host/ppapi_host.h" | 27 #include "ppapi/host/ppapi_host.h" |
28 #include "ppapi/proxy/ppapi_messages.h" | 28 #include "ppapi/proxy/ppapi_messages.h" |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 ScheduleOffscreenFlushAck(); | 681 ScheduleOffscreenFlushAck(); |
682 } else if (no_update_visible && is_plugin_visible && | 682 } else if (no_update_visible && is_plugin_visible && |
683 bound_instance_->view_data().is_page_visible) { | 683 bound_instance_->view_data().is_page_visible) { |
684 // There's nothing visible to invalidate so just schedule the callback to | 684 // There's nothing visible to invalidate so just schedule the callback to |
685 // execute in the next round of the message loop. | 685 // execute in the next round of the message loop. |
686 ScheduleOffscreenFlushAck(); | 686 ScheduleOffscreenFlushAck(); |
687 } else { | 687 } else { |
688 need_flush_ack_ = true; | 688 need_flush_ack_ = true; |
689 } | 689 } |
690 | 690 |
691 if (bound_instance_ && bound_instance_->throttler()) | 691 if (bound_instance_ && bound_instance_->throttler() && |
| 692 bound_instance_->throttler()->needs_representative_keyframe()) { |
692 bound_instance_->throttler()->OnImageFlush(image_data_->GetMappedBitmap()); | 693 bound_instance_->throttler()->OnImageFlush(image_data_->GetMappedBitmap()); |
| 694 } |
693 | 695 |
694 return PP_OK_COMPLETIONPENDING; | 696 return PP_OK_COMPLETIONPENDING; |
695 } | 697 } |
696 | 698 |
697 void PepperGraphics2DHost::ExecutePaintImageData(PPB_ImageData_Impl* image, | 699 void PepperGraphics2DHost::ExecutePaintImageData(PPB_ImageData_Impl* image, |
698 int x, | 700 int x, |
699 int y, | 701 int y, |
700 const gfx::Rect& src_rect, | 702 const gfx::Rect& src_rect, |
701 gfx::Rect* invalidated_rect) { | 703 gfx::Rect* invalidated_rect) { |
702 // Ensure the source image is mapped to read from it. | 704 // Ensure the source image is mapped to read from it. |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 gfx::Point inverse_scaled_point = | 817 gfx::Point inverse_scaled_point = |
816 gfx::ToFlooredPoint(gfx::ScalePoint(*delta, inverse_scale)); | 818 gfx::ToFlooredPoint(gfx::ScalePoint(*delta, inverse_scale)); |
817 if (original_delta != inverse_scaled_point) | 819 if (original_delta != inverse_scaled_point) |
818 return false; | 820 return false; |
819 } | 821 } |
820 | 822 |
821 return true; | 823 return true; |
822 } | 824 } |
823 | 825 |
824 } // namespace content | 826 } // namespace content |
OLD | NEW |