OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "webkit/glue/plugins/pepper_plugin_instance.h" | 5 #include "webkit/glue/plugins/pepper_plugin_instance.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #if defined(OS_MACOSX) | 9 #if defined(OS_MACOSX) |
10 #include "base/mac_util.h" | 10 #include "base/mac_util.h" |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 } | 581 } |
582 | 582 |
583 void PluginInstance::ViewChanged(const gfx::Rect& position, | 583 void PluginInstance::ViewChanged(const gfx::Rect& position, |
584 const gfx::Rect& clip) { | 584 const gfx::Rect& clip) { |
585 if (position.size() != position_.size() && bound_graphics_3d()) { | 585 if (position.size() != position_.size() && bound_graphics_3d()) { |
586 // TODO(apatrick): This is a hack to force the back buffer to resize. | 586 // TODO(apatrick): This is a hack to force the back buffer to resize. |
587 // It is obviously wrong to call SwapBuffers when a partial frame has | 587 // It is obviously wrong to call SwapBuffers when a partial frame has |
588 // potentially been rendered. Plan is to embed resize commands in the | 588 // potentially been rendered. Plan is to embed resize commands in the |
589 // command buffer just before ViewChanged is called. | 589 // command buffer just before ViewChanged is called. |
590 bound_graphics_3d()->ResizeBackingTexture(position.size()); | 590 bound_graphics_3d()->ResizeBackingTexture(position.size()); |
591 bound_graphics_3d()->SwapBuffers(); | 591 bound_graphics_3d()->SwapBuffers(PP_BlockUntilComplete()); |
592 } | 592 } |
593 | 593 |
594 position_ = position; | 594 position_ = position; |
595 | 595 |
596 if (clip.IsEmpty()) { | 596 if (clip.IsEmpty()) { |
597 // WebKit can give weird (x,y) positions for empty clip rects (since the | 597 // WebKit can give weird (x,y) positions for empty clip rects (since the |
598 // position technically doesn't matter). But we want to make these | 598 // position technically doesn't matter). But we want to make these |
599 // consistent since this is given to the plugin, so force everything to 0 | 599 // consistent since this is given to the plugin, so force everything to 0 |
600 // in the "everything is clipped" case. | 600 // in the "everything is clipped" case. |
601 clip_ = gfx::Rect(); | 601 clip_ = gfx::Rect(); |
(...skipping 27 matching lines...) Expand all Loading... |
629 has_content_area_focus_ = has_focus; | 629 has_content_area_focus_ = has_focus; |
630 if (PluginHasFocus() != old_plugin_focus) { | 630 if (PluginHasFocus() != old_plugin_focus) { |
631 instance_interface_->DidChangeFocus(pp_instance(), | 631 instance_interface_->DidChangeFocus(pp_instance(), |
632 BoolToPPBool(PluginHasFocus())); | 632 BoolToPPBool(PluginHasFocus())); |
633 } | 633 } |
634 } | 634 } |
635 | 635 |
636 void PluginInstance::ViewInitiatedPaint() { | 636 void PluginInstance::ViewInitiatedPaint() { |
637 if (bound_graphics_2d()) | 637 if (bound_graphics_2d()) |
638 bound_graphics_2d()->ViewInitiatedPaint(); | 638 bound_graphics_2d()->ViewInitiatedPaint(); |
| 639 if (bound_graphics_3d()) |
| 640 bound_graphics_3d()->ViewInitiatedPaint(); |
639 } | 641 } |
640 | 642 |
641 void PluginInstance::ViewFlushedPaint() { | 643 void PluginInstance::ViewFlushedPaint() { |
642 if (bound_graphics_2d()) | 644 if (bound_graphics_2d()) |
643 bound_graphics_2d()->ViewFlushedPaint(); | 645 bound_graphics_2d()->ViewFlushedPaint(); |
| 646 if (bound_graphics_3d()) |
| 647 bound_graphics_3d()->ViewFlushedPaint(); |
644 } | 648 } |
645 | 649 |
646 bool PluginInstance::GetBitmapForOptimizedPluginPaint( | 650 bool PluginInstance::GetBitmapForOptimizedPluginPaint( |
647 const gfx::Rect& paint_bounds, | 651 const gfx::Rect& paint_bounds, |
648 TransportDIB** dib, | 652 TransportDIB** dib, |
649 gfx::Rect* location, | 653 gfx::Rect* location, |
650 gfx::Rect* clip) { | 654 gfx::Rect* clip) { |
651 if (!always_on_top_) | 655 if (!always_on_top_) |
652 return false; | 656 return false; |
653 if (!bound_graphics_2d() || !bound_graphics_2d()->is_always_opaque()) | 657 if (!bound_graphics_2d() || !bound_graphics_2d()->is_always_opaque()) |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1170 } | 1174 } |
1171 | 1175 |
1172 Graphics3D* PluginInstance::bound_graphics_3d() const { | 1176 Graphics3D* PluginInstance::bound_graphics_3d() const { |
1173 if (bound_graphics_.get() == NULL) | 1177 if (bound_graphics_.get() == NULL) |
1174 return NULL; | 1178 return NULL; |
1175 | 1179 |
1176 return bound_graphics_->Cast<Graphics3D>(); | 1180 return bound_graphics_->Cast<Graphics3D>(); |
1177 } | 1181 } |
1178 | 1182 |
1179 } // namespace pepper | 1183 } // namespace pepper |
OLD | NEW |