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), | |
25 main_message_loop_(base::MessageLoopProxy::current()), | 24 main_message_loop_(base::MessageLoopProxy::current()), |
26 surface_id_(surface_id) { | 25 surface_id_(surface_id) { |
27 GLHelper* helper = ImageTransportFactory::GetInstance()->GetGLHelper(); | 26 GLHelper* helper = ImageTransportFactory::GetInstance()->GetGLHelper(); |
28 MainThreadData& main = GetMain(); | 27 MainThreadData& main = GetMain(); |
29 main.mailbox = new OwnedMailbox(helper); | 28 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 } |
30 impl_message_loop_->PostTask( | 34 impl_message_loop_->PostTask( |
31 FROM_HERE, | 35 FROM_HERE, |
32 base::Bind( | 36 base::Bind( |
33 &ReflectorImpl::InitOnImplThread, this, main.mailbox->holder())); | 37 &ReflectorImpl::InitOnImplThread, this, main.mailbox->holder())); |
34 } | 38 } |
35 | 39 |
36 ReflectorImpl::MainThreadData::MainThreadData( | 40 ReflectorImpl::MainThreadData::MainThreadData( |
37 ui::Compositor* mirrored_compositor, | 41 ui::Compositor* mirrored_compositor, |
38 ui::Layer* mirroring_layer) | 42 ui::Layer* mirroring_layer) |
39 : needs_set_mailbox(true), | 43 : needs_set_mailbox(true), |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 main.mirroring_layer->SchedulePaint(new_rect); | 247 main.mirroring_layer->SchedulePaint(new_rect); |
244 } | 248 } |
245 | 249 |
246 void ReflectorImpl::FullRedrawContentOnMainThread(bool flip_texture) { | 250 void ReflectorImpl::FullRedrawContentOnMainThread(bool flip_texture) { |
247 MainThreadData& main = GetMain(); | 251 MainThreadData& main = GetMain(); |
248 main.flip_texture = flip_texture; | 252 main.flip_texture = flip_texture; |
249 main.mirrored_compositor->ScheduleFullRedraw(); | 253 main.mirrored_compositor->ScheduleFullRedraw(); |
250 } | 254 } |
251 | 255 |
252 } // namespace content | 256 } // namespace content |
OLD | NEW |