| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/browser/compositor/reflector_impl.h" | 5 #include "content/browser/compositor/reflector_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "content/browser/compositor/browser_compositor_output_surface.h" | 9 #include "content/browser/compositor/browser_compositor_output_surface.h" |
| 10 #include "content/browser/compositor/owned_mailbox.h" | 10 #include "content/browser/compositor/owned_mailbox.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 void ReflectorImpl::OnSourceSurfaceReady( | 82 void ReflectorImpl::OnSourceSurfaceReady( |
| 83 BrowserCompositorOutputSurface* source_surface) { | 83 BrowserCompositorOutputSurface* source_surface) { |
| 84 ImplThreadData& impl = GetImpl(); | 84 ImplThreadData& impl = GetImpl(); |
| 85 AttachToOutputSurfaceOnImplThread(impl.mailbox_holder, source_surface); | 85 AttachToOutputSurfaceOnImplThread(impl.mailbox_holder, source_surface); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void ReflectorImpl::Shutdown() { | 88 void ReflectorImpl::Shutdown() { |
| 89 MainThreadData& main = GetMain(); | 89 MainThreadData& main = GetMain(); |
| 90 main.mailbox = NULL; | 90 main.mailbox = NULL; |
| 91 main.mirroring_layer->SetShowPaintedContent(); | 91 main.mirroring_layer->SetShowSolidColorContent(); |
| 92 main.mirroring_layer = NULL; | 92 main.mirroring_layer = NULL; |
| 93 impl_message_loop_->PostTask( | 93 impl_message_loop_->PostTask( |
| 94 FROM_HERE, base::Bind(&ReflectorImpl::ShutdownOnImplThread, this)); | 94 FROM_HERE, base::Bind(&ReflectorImpl::ShutdownOnImplThread, this)); |
| 95 } | 95 } |
| 96 | 96 |
| 97 void ReflectorImpl::DetachFromOutputSurface() { | 97 void ReflectorImpl::DetachFromOutputSurface() { |
| 98 ImplThreadData& impl = GetImpl(); | 98 ImplThreadData& impl = GetImpl(); |
| 99 DCHECK(impl.output_surface); | 99 DCHECK(impl.output_surface); |
| 100 impl.output_surface->SetReflector(NULL); | 100 impl.output_surface->SetReflector(NULL); |
| 101 DCHECK(impl.texture_id); | 101 DCHECK(impl.texture_id); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 115 base::Bind(&ReflectorImpl::DeleteOnMainThread, | 115 base::Bind(&ReflectorImpl::DeleteOnMainThread, |
| 116 scoped_refptr<ReflectorImpl>(this))); | 116 scoped_refptr<ReflectorImpl>(this))); |
| 117 } | 117 } |
| 118 | 118 |
| 119 void ReflectorImpl::ReattachToOutputSurfaceFromMainThread( | 119 void ReflectorImpl::ReattachToOutputSurfaceFromMainThread( |
| 120 BrowserCompositorOutputSurface* output_surface) { | 120 BrowserCompositorOutputSurface* output_surface) { |
| 121 MainThreadData& main = GetMain(); | 121 MainThreadData& main = GetMain(); |
| 122 GLHelper* helper = ImageTransportFactory::GetInstance()->GetGLHelper(); | 122 GLHelper* helper = ImageTransportFactory::GetInstance()->GetGLHelper(); |
| 123 main.mailbox = new OwnedMailbox(helper); | 123 main.mailbox = new OwnedMailbox(helper); |
| 124 main.needs_set_mailbox = true; | 124 main.needs_set_mailbox = true; |
| 125 main.mirroring_layer->SetShowPaintedContent(); | 125 main.mirroring_layer->SetShowSolidColorContent(); |
| 126 impl_message_loop_->PostTask( | 126 impl_message_loop_->PostTask( |
| 127 FROM_HERE, | 127 FROM_HERE, |
| 128 base::Bind(&ReflectorImpl::AttachToOutputSurfaceOnImplThread, | 128 base::Bind(&ReflectorImpl::AttachToOutputSurfaceOnImplThread, |
| 129 this, | 129 this, |
| 130 main.mailbox->holder(), | 130 main.mailbox->holder(), |
| 131 output_surface)); | 131 output_surface)); |
| 132 } | 132 } |
| 133 | 133 |
| 134 void ReflectorImpl::OnMirroringCompositorResized() { | 134 void ReflectorImpl::OnMirroringCompositorResized() { |
| 135 MainThreadData& main = GetMain(); | 135 MainThreadData& main = GetMain(); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 gfx::Rect new_rect(rect.x(), y, rect.width(), rect.height()); | 236 gfx::Rect new_rect(rect.x(), y, rect.width(), rect.height()); |
| 237 main.mirroring_layer->SchedulePaint(new_rect); | 237 main.mirroring_layer->SchedulePaint(new_rect); |
| 238 } | 238 } |
| 239 | 239 |
| 240 void ReflectorImpl::FullRedrawContentOnMainThread() { | 240 void ReflectorImpl::FullRedrawContentOnMainThread() { |
| 241 MainThreadData& main = GetMain(); | 241 MainThreadData& main = GetMain(); |
| 242 main.mirrored_compositor->ScheduleFullRedraw(); | 242 main.mirrored_compositor->ScheduleFullRedraw(); |
| 243 } | 243 } |
| 244 | 244 |
| 245 } // namespace content | 245 } // namespace content |
| OLD | NEW |