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

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

Issue 648413004: Make browser GPU channel creation async. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 | « ui/compositor/test/in_process_context_factory.h ('k') | no next file » | 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 "ui/compositor/test/in_process_context_factory.h" 5 #include "ui/compositor/test/in_process_context_factory.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/threading/thread.h" 8 #include "base/threading/thread.h"
9 #include "cc/surfaces/surface_id_allocator.h" 9 #include "cc/surfaces/surface_id_allocator.h"
10 #include "cc/test/pixel_test_output_surface.h" 10 #include "cc/test/pixel_test_output_surface.h"
(...skipping 21 matching lines...) Expand all
32 bool use_thread = false; 32 bool use_thread = false;
33 #endif 33 #endif
34 if (use_thread) { 34 if (use_thread) {
35 compositor_thread_.reset(new base::Thread("Browser Compositor")); 35 compositor_thread_.reset(new base::Thread("Browser Compositor"));
36 compositor_thread_->Start(); 36 compositor_thread_->Start();
37 } 37 }
38 } 38 }
39 39
40 InProcessContextFactory::~InProcessContextFactory() {} 40 InProcessContextFactory::~InProcessContextFactory() {}
41 41
42 scoped_ptr<cc::OutputSurface> InProcessContextFactory::CreateOutputSurface( 42 void InProcessContextFactory::CreateOutputSurface(
43 Compositor* compositor, 43 base::WeakPtr<Compositor> compositor,
44 bool software_fallback) { 44 bool software_fallback) {
45 DCHECK(!software_fallback); 45 DCHECK(!software_fallback);
46 blink::WebGraphicsContext3D::Attributes attrs; 46 blink::WebGraphicsContext3D::Attributes attrs;
47 attrs.depth = false; 47 attrs.depth = false;
48 attrs.stencil = false; 48 attrs.stencil = false;
49 attrs.antialias = false; 49 attrs.antialias = false;
50 attrs.shareResources = true; 50 attrs.shareResources = true;
51 bool lose_context_when_out_of_memory = true; 51 bool lose_context_when_out_of_memory = true;
52 52
53 using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl; 53 using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl;
54 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d( 54 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d(
55 WebGraphicsContext3DInProcessCommandBufferImpl::CreateViewContext( 55 WebGraphicsContext3DInProcessCommandBufferImpl::CreateViewContext(
56 attrs, lose_context_when_out_of_memory, compositor->widget())); 56 attrs, lose_context_when_out_of_memory, compositor->widget()));
57 CHECK(context3d); 57 CHECK(context3d);
58 58
59 using webkit::gpu::ContextProviderInProcess; 59 using webkit::gpu::ContextProviderInProcess;
60 scoped_refptr<ContextProviderInProcess> context_provider = 60 scoped_refptr<ContextProviderInProcess> context_provider =
61 ContextProviderInProcess::Create(context3d.Pass(), "UICompositor"); 61 ContextProviderInProcess::Create(context3d.Pass(), "UICompositor");
62 62
63 return make_scoped_ptr(new cc::PixelTestOutputSurface(context_provider)); 63 compositor->SetOutputSurface(
64 make_scoped_ptr(new cc::PixelTestOutputSurface(context_provider)));
64 } 65 }
65 66
66 scoped_refptr<Reflector> InProcessContextFactory::CreateReflector( 67 scoped_refptr<Reflector> InProcessContextFactory::CreateReflector(
67 Compositor* mirroed_compositor, 68 Compositor* mirroed_compositor,
68 Layer* mirroring_layer) { 69 Layer* mirroring_layer) {
69 return new Reflector(); 70 return new Reflector();
70 } 71 }
71 72
72 void InProcessContextFactory::RemoveReflector( 73 void InProcessContextFactory::RemoveReflector(
73 scoped_refptr<Reflector> reflector) {} 74 scoped_refptr<Reflector> reflector) {}
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 return compositor_thread_->message_loop_proxy().get(); 109 return compositor_thread_->message_loop_proxy().get();
109 } 110 }
110 111
111 scoped_ptr<cc::SurfaceIdAllocator> 112 scoped_ptr<cc::SurfaceIdAllocator>
112 InProcessContextFactory::CreateSurfaceIdAllocator() { 113 InProcessContextFactory::CreateSurfaceIdAllocator() {
113 return make_scoped_ptr( 114 return make_scoped_ptr(
114 new cc::SurfaceIdAllocator(next_surface_id_namespace_++)); 115 new cc::SurfaceIdAllocator(next_surface_id_namespace_++));
115 } 116 }
116 117
117 } // namespace ui 118 } // namespace ui
OLDNEW
« no previous file with comments | « 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