| 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/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/linked_ptr.h" | 10 #include "base/memory/linked_ptr.h" |
| (...skipping 1939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1950 return metafile->InitFromData(mapper.data(), mapper.size()); | 1950 return metafile->InitFromData(mapper.data(), mapper.size()); |
| 1951 | 1951 |
| 1952 NOTREACHED(); | 1952 NOTREACHED(); |
| 1953 #endif // ENABLE_PRINTING | 1953 #endif // ENABLE_PRINTING |
| 1954 return false; | 1954 return false; |
| 1955 } | 1955 } |
| 1956 | 1956 |
| 1957 void PepperPluginInstanceImpl::UpdateLayer(bool device_changed) { | 1957 void PepperPluginInstanceImpl::UpdateLayer(bool device_changed) { |
| 1958 if (!container_) | 1958 if (!container_) |
| 1959 return; | 1959 return; |
| 1960 if (throttler_ && throttler_->IsHiddenForPlaceholder()) |
| 1961 return; |
| 1960 | 1962 |
| 1961 gpu::Mailbox mailbox; | 1963 gpu::Mailbox mailbox; |
| 1962 uint32 sync_point = 0; | 1964 uint32 sync_point = 0; |
| 1963 if (bound_graphics_3d_.get()) { | 1965 if (bound_graphics_3d_.get()) { |
| 1964 bound_graphics_3d_->GetBackingMailbox(&mailbox, &sync_point); | 1966 bound_graphics_3d_->GetBackingMailbox(&mailbox, &sync_point); |
| 1965 DCHECK_EQ(mailbox.IsZero(), sync_point == 0); | 1967 DCHECK_EQ(mailbox.IsZero(), sync_point == 0); |
| 1966 } | 1968 } |
| 1967 bool want_3d_layer = !mailbox.IsZero(); | 1969 bool want_3d_layer = !mailbox.IsZero(); |
| 1968 bool want_2d_layer = !!bound_graphics_2d_platform_; | 1970 bool want_2d_layer = !!bound_graphics_2d_platform_; |
| 1969 bool want_texture_layer = want_3d_layer || want_2d_layer; | 1971 bool want_texture_layer = want_3d_layer || want_2d_layer; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2036 return bound_graphics_2d_platform_->PrepareTextureMailbox(mailbox, | 2038 return bound_graphics_2d_platform_->PrepareTextureMailbox(mailbox, |
| 2037 release_callback); | 2039 release_callback); |
| 2038 } | 2040 } |
| 2039 | 2041 |
| 2040 void PepperPluginInstanceImpl::OnDestruct() { render_frame_ = NULL; } | 2042 void PepperPluginInstanceImpl::OnDestruct() { render_frame_ = NULL; } |
| 2041 | 2043 |
| 2042 void PepperPluginInstanceImpl::OnThrottleStateChange() { | 2044 void PepperPluginInstanceImpl::OnThrottleStateChange() { |
| 2043 SendDidChangeView(); | 2045 SendDidChangeView(); |
| 2044 } | 2046 } |
| 2045 | 2047 |
| 2048 void PepperPluginInstanceImpl::OnHiddenForPlaceholder(bool hidden) { |
| 2049 if (hidden) { |
| 2050 container_->setWebLayer(nullptr); |
| 2051 } else { |
| 2052 UpdateLayer(true /* device_changed */); |
| 2053 } |
| 2054 } |
| 2055 |
| 2046 void PepperPluginInstanceImpl::AddLatencyInfo( | 2056 void PepperPluginInstanceImpl::AddLatencyInfo( |
| 2047 const std::vector<ui::LatencyInfo>& latency_info) { | 2057 const std::vector<ui::LatencyInfo>& latency_info) { |
| 2048 if (render_frame_ && render_frame_->GetRenderWidget()) { | 2058 if (render_frame_ && render_frame_->GetRenderWidget()) { |
| 2049 RenderWidgetCompositor* compositor = | 2059 RenderWidgetCompositor* compositor = |
| 2050 render_frame_->GetRenderWidget()->compositor(); | 2060 render_frame_->GetRenderWidget()->compositor(); |
| 2051 if (compositor) { | 2061 if (compositor) { |
| 2052 for (size_t i = 0; i < latency_info.size(); i++) { | 2062 for (size_t i = 0; i < latency_info.size(); i++) { |
| 2053 scoped_ptr<cc::SwapPromise> swap_promise( | 2063 scoped_ptr<cc::SwapPromise> swap_promise( |
| 2054 new cc::LatencyInfoSwapPromise(latency_info[i])); | 2064 new cc::LatencyInfoSwapPromise(latency_info[i])); |
| 2055 compositor->QueueSwapPromise(swap_promise.Pass()); | 2065 compositor->QueueSwapPromise(swap_promise.Pass()); |
| (...skipping 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3277 | 3287 |
| 3278 void PepperPluginInstanceImpl::RecordFlashJavaScriptUse() { | 3288 void PepperPluginInstanceImpl::RecordFlashJavaScriptUse() { |
| 3279 if (!javascript_used_ && is_flash_plugin_) { | 3289 if (!javascript_used_ && is_flash_plugin_) { |
| 3280 javascript_used_ = true; | 3290 javascript_used_ = true; |
| 3281 RenderThread::Get()->RecordAction( | 3291 RenderThread::Get()->RecordAction( |
| 3282 base::UserMetricsAction("Flash.JavaScriptUsed")); | 3292 base::UserMetricsAction("Flash.JavaScriptUsed")); |
| 3283 } | 3293 } |
| 3284 } | 3294 } |
| 3285 | 3295 |
| 3286 } // namespace content | 3296 } // namespace content |
| OLD | NEW |