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

Side by Side Diff: services/native_viewport/onscreen_context_provider.cc

Issue 1168993002: Update the native_viewport interface to allow specification of the surface configuration, currently… (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 6 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 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 "services/native_viewport/onscreen_context_provider.h" 5 #include "services/native_viewport/onscreen_context_provider.h"
6 6
7 #include "services/gles2/command_buffer_driver.h" 7 #include "services/gles2/command_buffer_driver.h"
8 #include "services/gles2/gpu_state.h" 8 #include "services/gles2/gpu_state.h"
9 9
10 namespace native_viewport { 10 namespace native_viewport {
11 11
12 OnscreenContextProvider::OnscreenContextProvider( 12 OnscreenContextProvider::OnscreenContextProvider(
13 const scoped_refptr<gles2::GpuState>& state) 13 const scoped_refptr<gles2::GpuState>& state)
14 : command_buffer_impl_(nullptr), 14 : requested_configuration_(gfx::SurfaceConfiguration()),
15 command_buffer_impl_(nullptr),
15 state_(state), 16 state_(state),
16 widget_(gfx::kNullAcceleratedWidget), 17 widget_(gfx::kNullAcceleratedWidget),
17 binding_(this) { 18 binding_(this) {
18 } 19 }
19 20
20 OnscreenContextProvider::~OnscreenContextProvider() { 21 OnscreenContextProvider::~OnscreenContextProvider() {
21 if (command_buffer_impl_) 22 if (command_buffer_impl_)
22 command_buffer_impl_->set_observer(nullptr); 23 command_buffer_impl_->set_observer(nullptr);
23 } 24 }
24 25
(...skipping 12 matching lines...) Expand all
37 } 38 }
38 return; 39 return;
39 } 40 }
40 41
41 if (pending_create_callback_.is_null()) 42 if (pending_create_callback_.is_null())
42 return; 43 return;
43 44
44 CreateAndReturnCommandBuffer(); 45 CreateAndReturnCommandBuffer();
45 } 46 }
46 47
48 void OnscreenContextProvider::SetSurfaceConfiguration(
49 gfx::SurfaceConfiguration requested_configuration) {
50 requested_configuration_ = requested_configuration;
51 }
abarth-chromium 2015/06/09 00:30:21 This function should be defined in the header and
iansf 2015/06/09 01:52:04 Done.
52
47 void OnscreenContextProvider::Create( 53 void OnscreenContextProvider::Create(
48 mojo::ViewportParameterListenerPtr viewport_parameter_listener, 54 mojo::ViewportParameterListenerPtr viewport_parameter_listener,
49 const CreateCallback& callback) { 55 const CreateCallback& callback) {
50 if (!pending_create_callback_.is_null()) { 56 if (!pending_create_callback_.is_null()) {
51 DCHECK(!command_buffer_impl_); 57 DCHECK(!command_buffer_impl_);
52 pending_create_callback_.Run(nullptr); 58 pending_create_callback_.Run(nullptr);
53 } 59 }
60
54 pending_listener_ = viewport_parameter_listener.Pass(); 61 pending_listener_ = viewport_parameter_listener.Pass();
55 pending_create_callback_ = callback; 62 pending_create_callback_ = callback;
56 63
57 if (widget_ != gfx::kNullAcceleratedWidget) 64 if (widget_ != gfx::kNullAcceleratedWidget)
58 CreateAndReturnCommandBuffer(); 65 CreateAndReturnCommandBuffer();
59 } 66 }
60 67
61 void OnscreenContextProvider::OnCommandBufferImplDestroyed() { 68 void OnscreenContextProvider::OnCommandBufferImplDestroyed() {
62 DCHECK(command_buffer_impl_); 69 DCHECK(command_buffer_impl_);
63 command_buffer_impl_ = nullptr; 70 command_buffer_impl_ = nullptr;
64 } 71 }
65 72
66 void OnscreenContextProvider::CreateAndReturnCommandBuffer() { 73 void OnscreenContextProvider::CreateAndReturnCommandBuffer() {
67 mojo::CommandBufferPtr cb; 74 mojo::CommandBufferPtr cb;
68 command_buffer_impl_ = new gles2::CommandBufferImpl( 75 command_buffer_impl_ = new gles2::CommandBufferImpl(
69 GetProxy(&cb), pending_listener_.Pass(), state_->control_task_runner(), 76 GetProxy(&cb), pending_listener_.Pass(), state_->control_task_runner(),
70 state_->sync_point_manager(), 77 state_->sync_point_manager(),
71 make_scoped_ptr(new gles2::CommandBufferDriver( 78 make_scoped_ptr(new gles2::CommandBufferDriver(
72 widget_, state_->share_group(), state_->mailbox_manager(), 79 widget_, state_->share_group(), state_->mailbox_manager(),
73 state_->sync_point_manager()))); 80 state_->sync_point_manager(), requested_configuration_)));
74 command_buffer_impl_->set_observer(this); 81 command_buffer_impl_->set_observer(this);
75 pending_create_callback_.Run(cb.Pass()); 82 pending_create_callback_.Run(cb.Pass());
76 pending_create_callback_.reset(); 83 pending_create_callback_.reset();
77 } 84 }
78 85
79 } // namespace mojo 86 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698