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

Side by Side Diff: mandoline/ui/aura/surface_binding.cc

Issue 1288653005: [Work In Progress] Use worker context provider in SurfaceBinding 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
« no previous file with comments | « no previous file | 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "mandoline/ui/aura/surface_binding.h" 5 #include "mandoline/ui/aura/surface_binding.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 16 matching lines...) Expand all
27 27
28 namespace mandoline { 28 namespace mandoline {
29 namespace { 29 namespace {
30 30
31 // OutputSurface --------------------------------------------------------------- 31 // OutputSurface ---------------------------------------------------------------
32 32
33 // OutputSurface implementation for a view. Pushes the surface id to View when 33 // OutputSurface implementation for a view. Pushes the surface id to View when
34 // appropriate. 34 // appropriate.
35 class OutputSurfaceImpl : public cc::OutputSurface { 35 class OutputSurfaceImpl : public cc::OutputSurface {
36 public: 36 public:
37 OutputSurfaceImpl(mojo::View* view, 37 OutputSurfaceImpl(
38 const scoped_refptr<cc::ContextProvider>& context_provider, 38 mojo::View* view,
39 mojo::Surface* surface, 39 const scoped_refptr<cc::ContextProvider>& context_provider,
40 uint32_t id_namespace, 40 const scoped_refptr<cc::ContextProvider>& worker_context_provider,
41 uint32_t* next_local_id); 41 mojo::Surface* surface,
42 uint32_t id_namespace,
43 uint32_t* next_local_id);
42 ~OutputSurfaceImpl() override; 44 ~OutputSurfaceImpl() override;
43 45
44 // cc::OutputSurface: 46 // cc::OutputSurface:
45 void SwapBuffers(cc::CompositorFrame* frame) override; 47 void SwapBuffers(cc::CompositorFrame* frame) override;
46 48
47 private: 49 private:
48 mojo::View* view_; 50 mojo::View* view_;
49 mojo::Surface* surface_; 51 mojo::Surface* surface_;
50 uint32_t id_namespace_; 52 uint32_t id_namespace_;
51 uint32_t* next_local_id_; // Owned by PerViewManagerState. 53 uint32_t* next_local_id_; // Owned by PerViewManagerState.
52 uint32_t local_id_; 54 uint32_t local_id_;
53 gfx::Size surface_size_; 55 gfx::Size surface_size_;
54 56
55 DISALLOW_COPY_AND_ASSIGN(OutputSurfaceImpl); 57 DISALLOW_COPY_AND_ASSIGN(OutputSurfaceImpl);
56 }; 58 };
57 59
58 OutputSurfaceImpl::OutputSurfaceImpl( 60 OutputSurfaceImpl::OutputSurfaceImpl(
59 mojo::View* view, 61 mojo::View* view,
60 const scoped_refptr<cc::ContextProvider>& context_provider, 62 const scoped_refptr<cc::ContextProvider>& context_provider,
63 const scoped_refptr<cc::ContextProvider>& worker_context_provider,
61 mojo::Surface* surface, 64 mojo::Surface* surface,
62 uint32_t id_namespace, 65 uint32_t id_namespace,
63 uint32_t* next_local_id) 66 uint32_t* next_local_id)
64 : cc::OutputSurface(context_provider), 67 : cc::OutputSurface(context_provider, worker_context_provider),
65 view_(view), 68 view_(view),
66 surface_(surface), 69 surface_(surface),
67 id_namespace_(id_namespace), 70 id_namespace_(id_namespace),
68 next_local_id_(next_local_id), 71 next_local_id_(next_local_id),
69 local_id_(0u) { 72 local_id_(0u) {
70 capabilities_.delegated_rendering = true; 73 capabilities_.delegated_rendering = true;
71 capabilities_.max_frames_pending = 1; 74 capabilities_.max_frames_pending = 1;
72 } 75 }
73 76
74 OutputSurfaceImpl::~OutputSurfaceImpl() { 77 OutputSurfaceImpl::~OutputSurfaceImpl() {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 (*view_map)[view_manager]->Init(); 168 (*view_map)[view_manager]->Init();
166 } 169 }
167 return (*view_map)[view_manager]; 170 return (*view_map)[view_manager];
168 } 171 }
169 172
170 scoped_ptr<cc::OutputSurface> 173 scoped_ptr<cc::OutputSurface>
171 SurfaceBinding::PerViewManagerState::CreateOutputSurface(mojo::View* view) { 174 SurfaceBinding::PerViewManagerState::CreateOutputSurface(mojo::View* view) {
172 // TODO(sky): figure out lifetime here. Do I need to worry about the return 175 // TODO(sky): figure out lifetime here. Do I need to worry about the return
173 // value outliving this? 176 // value outliving this?
174 mojo::CommandBufferPtr cb; 177 mojo::CommandBufferPtr cb;
178 mojo::CommandBufferPtr worker_cb;
175 gpu_->CreateOffscreenGLES2Context(GetProxy(&cb)); 179 gpu_->CreateOffscreenGLES2Context(GetProxy(&cb));
180 gpu_->CreateOffscreenGLES2Context(GetProxy(&worker_cb));
176 scoped_refptr<cc::ContextProvider> context_provider( 181 scoped_refptr<cc::ContextProvider> context_provider(
177 new mojo::ContextProviderMojo(cb.PassInterface().PassHandle())); 182 new mojo::ContextProviderMojo(cb.PassInterface().PassHandle()));
183 scoped_refptr<cc::ContextProvider> worker_context_provider(
184 new mojo::ContextProviderMojo(worker_cb.PassInterface().PassHandle()));
178 return make_scoped_ptr(new OutputSurfaceImpl( 185 return make_scoped_ptr(new OutputSurfaceImpl(
179 view, context_provider, surface_.get(), id_namespace_, &next_local_id_)); 186 view, context_provider, worker_context_provider, surface_.get(),
187 id_namespace_, &next_local_id_));
180 } 188 }
181 189
182 SurfaceBinding::PerViewManagerState::PerViewManagerState( 190 SurfaceBinding::PerViewManagerState::PerViewManagerState(
183 mojo::Shell* shell, 191 mojo::Shell* shell,
184 mojo::ViewManager* view_manager) 192 mojo::ViewManager* view_manager)
185 : shell_(shell), 193 : shell_(shell),
186 view_manager_(view_manager), 194 view_manager_(view_manager),
187 returner_binding_(this), 195 returner_binding_(this),
188 id_namespace_(0u), 196 id_namespace_(0u),
189 next_local_id_(0u) { 197 next_local_id_(0u) {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 } 258 }
251 259
252 SurfaceBinding::~SurfaceBinding() { 260 SurfaceBinding::~SurfaceBinding() {
253 } 261 }
254 262
255 scoped_ptr<cc::OutputSurface> SurfaceBinding::CreateOutputSurface() { 263 scoped_ptr<cc::OutputSurface> SurfaceBinding::CreateOutputSurface() {
256 return state_->CreateOutputSurface(view_); 264 return state_->CreateOutputSurface(view_);
257 } 265 }
258 266
259 } // namespace mandoline 267 } // namespace mandoline
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698