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" |
11 #include "content/common/gpu/client/gl_helper.h" | 11 #include "content/common/gpu/client/gl_helper.h" |
12 #include "ui/compositor/layer.h" | 12 #include "ui/compositor/layer.h" |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 | 15 |
16 ReflectorImpl::ReflectorImpl( | 16 ReflectorImpl::ReflectorImpl( |
17 ui::Compositor* mirrored_compositor, | 17 ui::Compositor* mirrored_compositor, |
18 ui::Layer* mirroring_layer, | 18 ui::Layer* mirroring_layer, |
19 IDMap<BrowserCompositorOutputSurface>* output_surface_map, | 19 IDMap<BrowserCompositorOutputSurface>* output_surface_map, |
20 base::MessageLoopProxy* compositor_thread_loop, | 20 base::MessageLoopProxy* compositor_thread_loop, |
21 int surface_id) | 21 int surface_id) |
22 : impl_unsafe_(output_surface_map), | 22 : impl_unsafe_(output_surface_map), |
23 main_unsafe_(mirrored_compositor, mirroring_layer), | 23 main_unsafe_(mirrored_compositor, mirroring_layer), |
| 24 impl_message_loop_(compositor_thread_loop), |
24 main_message_loop_(base::MessageLoopProxy::current()), | 25 main_message_loop_(base::MessageLoopProxy::current()), |
25 surface_id_(surface_id) { | 26 surface_id_(surface_id) { |
26 GLHelper* helper = ImageTransportFactory::GetInstance()->GetGLHelper(); | 27 GLHelper* helper = ImageTransportFactory::GetInstance()->GetGLHelper(); |
27 MainThreadData& main = GetMain(); | 28 MainThreadData& main = GetMain(); |
28 main.mailbox = new OwnedMailbox(helper); | 29 main.mailbox = new OwnedMailbox(helper); |
29 if (!compositor_thread_loop) { | |
30 impl_message_loop_ = main_message_loop_; | |
31 } else { | |
32 impl_message_loop_ = compositor_thread_loop; | |
33 } | |
34 impl_message_loop_->PostTask( | 30 impl_message_loop_->PostTask( |
35 FROM_HERE, | 31 FROM_HERE, |
36 base::Bind( | 32 base::Bind( |
37 &ReflectorImpl::InitOnImplThread, this, main.mailbox->holder())); | 33 &ReflectorImpl::InitOnImplThread, this, main.mailbox->holder())); |
38 } | 34 } |
39 | 35 |
40 ReflectorImpl::MainThreadData::MainThreadData( | 36 ReflectorImpl::MainThreadData::MainThreadData( |
41 ui::Compositor* mirrored_compositor, | 37 ui::Compositor* mirrored_compositor, |
42 ui::Layer* mirroring_layer) | 38 ui::Layer* mirroring_layer) |
43 : needs_set_mailbox(true), | 39 : needs_set_mailbox(true), |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 main.mirroring_layer->SchedulePaint(new_rect); | 243 main.mirroring_layer->SchedulePaint(new_rect); |
248 } | 244 } |
249 | 245 |
250 void ReflectorImpl::FullRedrawContentOnMainThread(bool flip_texture) { | 246 void ReflectorImpl::FullRedrawContentOnMainThread(bool flip_texture) { |
251 MainThreadData& main = GetMain(); | 247 MainThreadData& main = GetMain(); |
252 main.flip_texture = flip_texture; | 248 main.flip_texture = flip_texture; |
253 main.mirrored_compositor->ScheduleFullRedraw(); | 249 main.mirrored_compositor->ScheduleFullRedraw(); |
254 } | 250 } |
255 | 251 |
256 } // namespace content | 252 } // namespace content |
OLD | NEW |