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

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

Issue 2049083002: Implement MusGpuMemoryBufferManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update the mojom document Created 4 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
« no previous file with comments | « components/mus/surfaces/surfaces_context_provider.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 "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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 attributes.bind_generates_resource = false; 53 attributes.bind_generates_resource = false;
54 attributes.lose_context_when_out_of_memory = true; 54 attributes.lose_context_when_out_of_memory = true;
55 gl::GpuPreference gpu_preference = gl::PreferIntegratedGpu; 55 gl::GpuPreference gpu_preference = gl::PreferIntegratedGpu;
56 GURL active_url; 56 GURL active_url;
57 scoped_refptr<base::SingleThreadTaskRunner> task_runner = 57 scoped_refptr<base::SingleThreadTaskRunner> task_runner =
58 base::ThreadTaskRunnerHandle::Get(); 58 base::ThreadTaskRunnerHandle::Get();
59 command_buffer_proxy_impl_ = gpu::CommandBufferProxyImpl::Create( 59 command_buffer_proxy_impl_ = gpu::CommandBufferProxyImpl::Create(
60 service->gpu_channel_local(), widget, gfx::Size(), 60 service->gpu_channel_local(), widget, gfx::Size(),
61 shared_command_buffer, stream_id, stream_priority, attributes, 61 shared_command_buffer, stream_id, stream_priority, attributes,
62 active_url, gpu_preference, task_runner); 62 active_url, gpu_preference, task_runner);
63 command_buffer_proxy_impl_->SetSwapBuffersCompletionCallback(
64 base::Bind(&SurfacesContextProvider::OnGpuSwapBuffersCompleted,
65 base::Unretained(this)));
66 command_buffer_proxy_impl_->SetUpdateVSyncParametersCallback(
67 base::Bind(&SurfacesContextProvider::OnUpdateVSyncParameters,
68 base::Unretained(this)));
63 } 69 }
64 } 70 }
65 71
66 void SurfacesContextProvider::SetDelegate( 72 void SurfacesContextProvider::SetDelegate(
67 SurfacesContextProviderDelegate* delegate) { 73 SurfacesContextProviderDelegate* delegate) {
68 DCHECK(!delegate_); 74 DCHECK(!delegate_);
69 delegate_ = delegate; 75 delegate_ = delegate;
70 } 76 }
71 77
72 // This routine needs to be safe to call more than once. 78 // This routine needs to be safe to call more than once.
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 if (delegate_) 169 if (delegate_)
164 delegate_->OnVSyncParametersUpdated(timebase, interval); 170 delegate_->OnVSyncParametersUpdated(timebase, interval);
165 } 171 }
166 172
167 void SurfacesContextProvider::GpuCompletedSwapBuffers(gfx::SwapResult result) { 173 void SurfacesContextProvider::GpuCompletedSwapBuffers(gfx::SwapResult result) {
168 if (!swap_buffers_completion_callback_.is_null()) { 174 if (!swap_buffers_completion_callback_.is_null()) {
169 swap_buffers_completion_callback_.Run(result); 175 swap_buffers_completion_callback_.Run(result);
170 } 176 }
171 } 177 }
172 178
179 void SurfacesContextProvider::OnGpuSwapBuffersCompleted(
180 const std::vector<ui::LatencyInfo>& latency_info,
181 gfx::SwapResult result,
182 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac) {
183 if (!swap_buffers_completion_callback_.is_null()) {
184 swap_buffers_completion_callback_.Run(result);
185 }
186 }
187
188 void SurfacesContextProvider::OnUpdateVSyncParameters(
189 base::TimeTicks timebase,
190 base::TimeDelta interval) {
191 if (delegate_) {
192 delegate_->OnVSyncParametersUpdated(timebase.ToInternalValue(),
193 interval.ToInternalValue());
194 }
195 }
196
173 void SurfacesContextProvider::SetSwapBuffersCompletionCallback( 197 void SurfacesContextProvider::SetSwapBuffersCompletionCallback(
174 gl::GLSurface::SwapCompletionCallback callback) { 198 gl::GLSurface::SwapCompletionCallback callback) {
175 swap_buffers_completion_callback_ = callback; 199 swap_buffers_completion_callback_ = callback;
176 } 200 }
177 201
178 } // namespace mus 202 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/surfaces/surfaces_context_provider.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698