Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: content/browser/compositor/reflector_impl.cc

Issue 899073003: Make Reflector Use Main Thread MessageLoop when in SingleThread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@turnitoff
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/compositor/reflector_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « no previous file | content/browser/compositor/reflector_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698