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

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

Issue 1273163004: Revert of cc: Use worker context for one-copy tile initialization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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
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/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/threading/thread.h" 9 #include "base/threading/thread.h"
10 #include "cc/output/compositor_frame.h" 10 #include "cc/output/compositor_frame.h"
(...skipping 23 matching lines...) Expand all
34 ~FakeReflector() override {} 34 ~FakeReflector() override {}
35 void OnMirroringCompositorResized() override {} 35 void OnMirroringCompositorResized() override {}
36 void AddMirroringLayer(Layer* layer) override {} 36 void AddMirroringLayer(Layer* layer) override {}
37 void RemoveMirroringLayer(Layer* layer) override {} 37 void RemoveMirroringLayer(Layer* layer) override {}
38 }; 38 };
39 39
40 // An OutputSurface implementation that directly draws and swaps to an actual 40 // An OutputSurface implementation that directly draws and swaps to an actual
41 // GL surface. 41 // GL surface.
42 class DirectOutputSurface : public cc::OutputSurface { 42 class DirectOutputSurface : public cc::OutputSurface {
43 public: 43 public:
44 DirectOutputSurface( 44 explicit DirectOutputSurface(
45 const scoped_refptr<cc::ContextProvider>& context_provider, 45 const scoped_refptr<cc::ContextProvider>& context_provider)
46 const scoped_refptr<cc::ContextProvider>& worker_context_provider) 46 : cc::OutputSurface(context_provider), weak_ptr_factory_(this) {}
47 : cc::OutputSurface(context_provider, worker_context_provider),
48 weak_ptr_factory_(this) {}
49 47
50 ~DirectOutputSurface() override {} 48 ~DirectOutputSurface() override {}
51 49
52 // cc::OutputSurface implementation 50 // cc::OutputSurface implementation
53 void SwapBuffers(cc::CompositorFrame* frame) override { 51 void SwapBuffers(cc::CompositorFrame* frame) override {
54 DCHECK(context_provider_.get()); 52 DCHECK(context_provider_.get());
55 DCHECK(frame->gl_frame_data); 53 DCHECK(frame->gl_frame_data);
56 if (frame->gl_frame_data->sub_buffer_rect == 54 if (frame->gl_frame_data->sub_buffer_rect ==
57 gfx::Rect(frame->gl_frame_data->size)) { 55 gfx::Rect(frame->gl_frame_data->size)) {
58 context_provider_->ContextSupport()->Swap(); 56 context_provider_->ContextSupport()->Swap();
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 attribs.stencil_size = 0; 103 attribs.stencil_size = 0;
106 attribs.samples = 0; 104 attribs.samples = 0;
107 attribs.sample_buffers = 0; 105 attribs.sample_buffers = 0;
108 attribs.fail_if_major_perf_caveat = false; 106 attribs.fail_if_major_perf_caveat = false;
109 attribs.bind_generates_resource = false; 107 attribs.bind_generates_resource = false;
110 108
111 scoped_refptr<InProcessContextProvider> context_provider = 109 scoped_refptr<InProcessContextProvider> context_provider =
112 InProcessContextProvider::Create(attribs, &gpu_memory_buffer_manager_, 110 InProcessContextProvider::Create(attribs, &gpu_memory_buffer_manager_,
113 &image_factory_, 111 &image_factory_,
114 compositor->widget(), "UICompositor"); 112 compositor->widget(), "UICompositor");
115 scoped_refptr<InProcessContextProvider> worker_context_provider =
116 InProcessContextProvider::CreateOffscreen(&gpu_memory_buffer_manager_,
117 &image_factory_);
118 113
119 scoped_ptr<cc::OutputSurface> real_output_surface; 114 scoped_ptr<cc::OutputSurface> real_output_surface;
120 115
121 if (use_test_surface_) { 116 if (use_test_surface_) {
122 bool flipped_output_surface = false; 117 bool flipped_output_surface = false;
123 real_output_surface = make_scoped_ptr(new cc::PixelTestOutputSurface( 118 real_output_surface = make_scoped_ptr(new cc::PixelTestOutputSurface(
124 context_provider, worker_context_provider, flipped_output_surface)); 119 context_provider, flipped_output_surface));
125 } else { 120 } else {
126 real_output_surface = make_scoped_ptr( 121 real_output_surface =
127 new DirectOutputSurface(context_provider, worker_context_provider)); 122 make_scoped_ptr(new DirectOutputSurface(context_provider));
128 } 123 }
129 124
130 if (surface_manager_) { 125 if (surface_manager_) {
131 scoped_ptr<cc::OnscreenDisplayClient> display_client( 126 scoped_ptr<cc::OnscreenDisplayClient> display_client(
132 new cc::OnscreenDisplayClient( 127 new cc::OnscreenDisplayClient(
133 real_output_surface.Pass(), surface_manager_, 128 real_output_surface.Pass(), surface_manager_,
134 GetSharedBitmapManager(), GetGpuMemoryBufferManager(), 129 GetSharedBitmapManager(), GetGpuMemoryBufferManager(),
135 compositor->GetRendererSettings(), compositor->task_runner())); 130 compositor->GetRendererSettings(), compositor->task_runner()));
136 scoped_ptr<cc::SurfaceDisplayOutputSurface> surface_output_surface( 131 scoped_ptr<cc::SurfaceDisplayOutputSurface> surface_output_surface(
137 new cc::SurfaceDisplayOutputSurface( 132 new cc::SurfaceDisplayOutputSurface(surface_manager_,
138 surface_manager_, compositor->surface_id_allocator(), 133 compositor->surface_id_allocator(),
139 context_provider, worker_context_provider)); 134 context_provider));
140 display_client->set_surface_output_surface(surface_output_surface.get()); 135 display_client->set_surface_output_surface(surface_output_surface.get());
141 surface_output_surface->set_display_client(display_client.get()); 136 surface_output_surface->set_display_client(display_client.get());
142 137
143 compositor->SetOutputSurface(surface_output_surface.Pass()); 138 compositor->SetOutputSurface(surface_output_surface.Pass());
144 139
145 delete per_compositor_data_[compositor.get()]; 140 delete per_compositor_data_[compositor.get()];
146 per_compositor_data_[compositor.get()] = display_client.release(); 141 per_compositor_data_[compositor.get()] = display_client.release();
147 } else { 142 } else {
148 compositor->SetOutputSurface(real_output_surface.Pass()); 143 compositor->SetOutputSurface(real_output_surface.Pass());
149 } 144 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 } 207 }
213 208
214 void InProcessContextFactory::ResizeDisplay(ui::Compositor* compositor, 209 void InProcessContextFactory::ResizeDisplay(ui::Compositor* compositor,
215 const gfx::Size& size) { 210 const gfx::Size& size) {
216 if (!per_compositor_data_.count(compositor)) 211 if (!per_compositor_data_.count(compositor))
217 return; 212 return;
218 per_compositor_data_[compositor]->display()->Resize(size); 213 per_compositor_data_[compositor]->display()->Resize(size);
219 } 214 }
220 215
221 } // namespace ui 216 } // namespace ui
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/query_manager.cc ('k') | ui/compositor/test/in_process_context_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698