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

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

Issue 900133002: Revert of 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),
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
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
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