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

Side by Side Diff: ui/compositor/test/in_process_context_factory.cc

Issue 277713002: ui/compositor: move the browser compositor thread to the ContextFactory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
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 "ui/compositor/test/in_process_context_factory.h" 5 #include "ui/compositor/test/in_process_context_factory.h"
6 6
7 #include "base/threading/thread.h"
7 #include "cc/output/output_surface.h" 8 #include "cc/output/output_surface.h"
8 #include "cc/test/test_shared_bitmap_manager.h" 9 #include "cc/test/test_shared_bitmap_manager.h"
9 #include "ui/compositor/reflector.h" 10 #include "ui/compositor/reflector.h"
10 #include "ui/gl/gl_implementation.h" 11 #include "ui/gl/gl_implementation.h"
11 #include "ui/gl/gl_surface.h" 12 #include "ui/gl/gl_surface.h"
12 #include "webkit/common/gpu/context_provider_in_process.h" 13 #include "webkit/common/gpu/context_provider_in_process.h"
13 #include "webkit/common/gpu/grcontext_for_webgraphicscontext3d.h" 14 #include "webkit/common/gpu/grcontext_for_webgraphicscontext3d.h"
14 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl. h" 15 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl. h"
15 16
16 namespace ui { 17 namespace ui {
17 18
18 InProcessContextFactory::InProcessContextFactory() 19 InProcessContextFactory::InProcessContextFactory()
19 : shared_bitmap_manager_(new cc::TestSharedBitmapManager()) { 20 : shared_bitmap_manager_(new cc::TestSharedBitmapManager()) {
20 DCHECK_NE(gfx::GetGLImplementation(), gfx::kGLImplementationNone); 21 DCHECK_NE(gfx::GetGLImplementation(), gfx::kGLImplementationNone);
22 #if defined(OS_CHROMEOS)
23 bool use_thread = !CommandLine::ForCurrentProcess()->HasSwitch(
24 switches::kUIDisableThreadedCompositing);
25 #else
26 bool use_thread = false;
27 #endif
28 if (use_thread) {
29 compositor_thread_.reset(new base::Thread("Browser Compositor"));
30 compositor_thread_->Start();
31 }
21 } 32 }
22 33
23 InProcessContextFactory::~InProcessContextFactory() {} 34 InProcessContextFactory::~InProcessContextFactory() {
35 if (compositor_thread_.get()) {
danakj 2014/05/08 22:37:30 nit: no need .get() for scoped_ptr
piman 2014/05/08 22:48:34 Done.
36 compositor_thread_->Stop();
danakj 2014/05/08 22:37:30 Doesn't this happen in the destructor? Why do we n
piman 2014/05/08 22:48:34 Done.
37 compositor_thread_.reset();
38 }
39 }
24 40
25 scoped_ptr<cc::OutputSurface> InProcessContextFactory::CreateOutputSurface( 41 scoped_ptr<cc::OutputSurface> InProcessContextFactory::CreateOutputSurface(
26 Compositor* compositor, 42 Compositor* compositor,
27 bool software_fallback) { 43 bool software_fallback) {
28 DCHECK(!software_fallback); 44 DCHECK(!software_fallback);
29 blink::WebGraphicsContext3D::Attributes attrs; 45 blink::WebGraphicsContext3D::Attributes attrs;
30 attrs.depth = false; 46 attrs.depth = false;
31 attrs.stencil = false; 47 attrs.stencil = false;
32 attrs.antialias = false; 48 attrs.antialias = false;
33 attrs.shareResources = true; 49 attrs.shareResources = true;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 } 89 }
74 90
75 void InProcessContextFactory::RemoveCompositor(Compositor* compositor) {} 91 void InProcessContextFactory::RemoveCompositor(Compositor* compositor) {}
76 92
77 bool InProcessContextFactory::DoesCreateTestContexts() { return false; } 93 bool InProcessContextFactory::DoesCreateTestContexts() { return false; }
78 94
79 cc::SharedBitmapManager* InProcessContextFactory::GetSharedBitmapManager() { 95 cc::SharedBitmapManager* InProcessContextFactory::GetSharedBitmapManager() {
80 return shared_bitmap_manager_.get(); 96 return shared_bitmap_manager_.get();
81 } 97 }
82 98
99 base::MessageLoopProxy* InProcessContextFactory::GetCompositorMessageLoop() {
100 if (!compositor_thread_)
101 return NULL;
102 return compositor_thread_->message_loop_proxy();
103 }
104
83 } // namespace ui 105 } // namespace ui
OLDNEW
« ui/aura/env.cc ('K') | « ui/compositor/test/in_process_context_factory.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698