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

Side by Side Diff: components/mus/surfaces/surfaces_context_provider.cc

Issue 1821863002: Hook up ui::Compositor to Display's BeginFrameSource (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Display member destruction order Created 4 years, 8 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 "components/mus/surfaces/surfaces_context_provider.h" 5 #include "components/mus/surfaces/surfaces_context_provider.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 10 matching lines...) Expand all
21 namespace mus { 21 namespace mus {
22 22
23 namespace { 23 namespace {
24 const size_t kDefaultCommandBufferSize = 1024 * 1024; 24 const size_t kDefaultCommandBufferSize = 1024 * 1024;
25 const size_t kDefaultStartTransferBufferSize = 1 * 1024 * 1024; 25 const size_t kDefaultStartTransferBufferSize = 1 * 1024 * 1024;
26 const size_t kDefaultMinTransferBufferSize = 1 * 256 * 1024; 26 const size_t kDefaultMinTransferBufferSize = 1 * 256 * 1024;
27 const size_t kDefaultMaxTransferBufferSize = 16 * 1024 * 1024; 27 const size_t kDefaultMaxTransferBufferSize = 16 * 1024 * 1024;
28 } 28 }
29 29
30 SurfacesContextProvider::SurfacesContextProvider( 30 SurfacesContextProvider::SurfacesContextProvider(
31 SurfacesContextProviderDelegate* delegate,
32 gfx::AcceleratedWidget widget, 31 gfx::AcceleratedWidget widget,
33 const scoped_refptr<GpuState>& state) 32 const scoped_refptr<GpuState>& state)
34 : delegate_(delegate), widget_(widget), command_buffer_local_(nullptr) { 33 : delegate_(nullptr), widget_(widget), command_buffer_local_(nullptr) {
35 capabilities_.gpu.image = true; 34 capabilities_.gpu.image = true;
36 command_buffer_local_ = new CommandBufferLocal(this, widget_, state); 35 command_buffer_local_ = new CommandBufferLocal(this, widget_, state);
37 } 36 }
38 37
38 void SurfacesContextProvider::SetDelegate(
39 SurfacesContextProviderDelegate* delegate) {
40 DCHECK(!delegate_);
41 delegate_ = delegate;
42 }
43
39 // This routine needs to be safe to call more than once. 44 // This routine needs to be safe to call more than once.
40 // This is called when we have an accelerated widget. 45 // This is called when we have an accelerated widget.
41 bool SurfacesContextProvider::BindToCurrentThread() { 46 bool SurfacesContextProvider::BindToCurrentThread() {
42 if (implementation_) 47 if (implementation_)
43 return true; 48 return true;
44 49
45 // SurfacesContextProvider should always live on the same thread as the 50 // SurfacesContextProvider should always live on the same thread as the
46 // Window Manager. 51 // Window Manager.
47 DCHECK(CalledOnValidThread()); 52 DCHECK(CalledOnValidThread());
48 if (!command_buffer_local_->Initialize()) 53 if (!command_buffer_local_->Initialize())
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 swap_buffers_completion_callback_.Run(result); 125 swap_buffers_completion_callback_.Run(result);
121 } 126 }
122 } 127 }
123 128
124 void SurfacesContextProvider::SetSwapBuffersCompletionCallback( 129 void SurfacesContextProvider::SetSwapBuffersCompletionCallback(
125 gfx::GLSurface::SwapCompletionCallback callback) { 130 gfx::GLSurface::SwapCompletionCallback callback) {
126 swap_buffers_completion_callback_ = callback; 131 swap_buffers_completion_callback_ = callback;
127 } 132 }
128 133
129 } // namespace mus 134 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/surfaces/surfaces_context_provider.h ('k') | components/mus/surfaces/top_level_display_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698