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" |
11 #include "base/callback_helpers.h" | 11 #include "base/callback_helpers.h" |
12 #include "base/location.h" | 12 #include "base/location.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
15 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
16 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
17 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
18 #include "base/strings/stringprintf.h" | 18 #include "base/strings/stringprintf.h" |
19 #include "base/strings/utf_offset_string_conversions.h" | 19 #include "base/strings/utf_offset_string_conversions.h" |
20 #include "base/strings/utf_string_conversions.h" | 20 #include "base/strings/utf_string_conversions.h" |
21 #include "base/thread_task_runner_handle.h" | 21 #include "base/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/layer_settings.h" | |
27 #include "cc/layers/texture_layer.h" | 26 #include "cc/layers/texture_layer.h" |
28 #include "content/common/content_constants_internal.h" | 27 #include "content/common/content_constants_internal.h" |
29 #include "content/common/frame_messages.h" | 28 #include "content/common/frame_messages.h" |
30 #include "content/public/common/content_constants.h" | 29 #include "content/public/common/content_constants.h" |
31 #include "content/public/renderer/content_renderer_client.h" | 30 #include "content/public/renderer/content_renderer_client.h" |
32 #include "content/renderer/pepper/content_decryptor_delegate.h" | 31 #include "content/renderer/pepper/content_decryptor_delegate.h" |
33 #include "content/renderer/pepper/event_conversion.h" | 32 #include "content/renderer/pepper/event_conversion.h" |
34 #include "content/renderer/pepper/fullscreen_container.h" | 33 #include "content/renderer/pepper/fullscreen_container.h" |
35 #include "content/renderer/pepper/gfx_conversion.h" | 34 #include "content/renderer/pepper/gfx_conversion.h" |
36 #include "content/renderer/pepper/host_dispatcher_wrapper.h" | 35 #include "content/renderer/pepper/host_dispatcher_wrapper.h" |
(...skipping 1995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2032 texture_layer_->ClearClient(); | 2031 texture_layer_->ClearClient(); |
2033 texture_layer_ = NULL; | 2032 texture_layer_ = NULL; |
2034 } | 2033 } |
2035 compositor_layer_ = NULL; | 2034 compositor_layer_ = NULL; |
2036 } | 2035 } |
2037 | 2036 |
2038 if (want_texture_layer) { | 2037 if (want_texture_layer) { |
2039 bool opaque = false; | 2038 bool opaque = false; |
2040 if (want_3d_layer) { | 2039 if (want_3d_layer) { |
2041 DCHECK(bound_graphics_3d_.get()); | 2040 DCHECK(bound_graphics_3d_.get()); |
2042 texture_layer_ = cc::TextureLayer::CreateForMailbox( | 2041 texture_layer_ = cc::TextureLayer::CreateForMailbox(NULL); |
2043 cc::LayerSettings(), NULL); | |
2044 opaque = bound_graphics_3d_->IsOpaque(); | 2042 opaque = bound_graphics_3d_->IsOpaque(); |
2045 texture_layer_->SetTextureMailboxWithoutReleaseCallback( | 2043 texture_layer_->SetTextureMailboxWithoutReleaseCallback( |
2046 cc::TextureMailbox(mailbox, sync_token, GL_TEXTURE_2D)); | 2044 cc::TextureMailbox(mailbox, sync_token, GL_TEXTURE_2D)); |
2047 } else { | 2045 } else { |
2048 DCHECK(bound_graphics_2d_platform_); | 2046 DCHECK(bound_graphics_2d_platform_); |
2049 texture_layer_ = cc::TextureLayer::CreateForMailbox( | 2047 texture_layer_ = cc::TextureLayer::CreateForMailbox(this); |
2050 cc::LayerSettings(), this); | |
2051 bound_graphics_2d_platform_->AttachedToNewLayer(); | 2048 bound_graphics_2d_platform_->AttachedToNewLayer(); |
2052 opaque = bound_graphics_2d_platform_->IsAlwaysOpaque(); | 2049 opaque = bound_graphics_2d_platform_->IsAlwaysOpaque(); |
2053 texture_layer_->SetFlipped(false); | 2050 texture_layer_->SetFlipped(false); |
2054 } | 2051 } |
2055 | 2052 |
2056 // Ignore transparency in fullscreen, since that's what Flash always | 2053 // Ignore transparency in fullscreen, since that's what Flash always |
2057 // wants to do, and that lets it not recreate a context if | 2054 // wants to do, and that lets it not recreate a context if |
2058 // wmode=transparent was specified. | 2055 // wmode=transparent was specified. |
2059 opaque = opaque || fullscreen_container_; | 2056 opaque = opaque || fullscreen_container_; |
2060 texture_layer_->SetContentsOpaque(opaque); | 2057 texture_layer_->SetContentsOpaque(opaque); |
(...skipping 1261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3322 } | 3319 } |
3323 | 3320 |
3324 void PepperPluginInstanceImpl::ConvertDIPToViewport(gfx::Rect* rect) const { | 3321 void PepperPluginInstanceImpl::ConvertDIPToViewport(gfx::Rect* rect) const { |
3325 rect->set_x(rect->x() / viewport_to_dip_scale_); | 3322 rect->set_x(rect->x() / viewport_to_dip_scale_); |
3326 rect->set_y(rect->y() / viewport_to_dip_scale_); | 3323 rect->set_y(rect->y() / viewport_to_dip_scale_); |
3327 rect->set_width(rect->width() / viewport_to_dip_scale_); | 3324 rect->set_width(rect->width() / viewport_to_dip_scale_); |
3328 rect->set_height(rect->height() / viewport_to_dip_scale_); | 3325 rect->set_height(rect->height() / viewport_to_dip_scale_); |
3329 } | 3326 } |
3330 | 3327 |
3331 } // namespace content | 3328 } // namespace content |
OLD | NEW |