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

Side by Side Diff: services/ui/gpu/gpu_service.cc

Issue 2717233003: gpu: Use mojom API for getting video memory usage. (Closed)
Patch Set: . Created 3 years, 9 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 | « services/ui/gpu/gpu_service.h ('k') | services/ui/gpu/interfaces/gpu_service.mojom » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/ui/gpu/gpu_service.h" 5 #include "services/ui/gpu/gpu_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/crash_logging.h" 8 #include "base/debug/crash_logging.h"
9 #include "base/memory/shared_memory.h" 9 #include "base/memory/shared_memory.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 } 120 }
121 121
122 void GpuService::DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, 122 void GpuService::DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
123 int client_id, 123 int client_id,
124 const gpu::SyncToken& sync_token) { 124 const gpu::SyncToken& sync_token) {
125 DCHECK(CalledOnValidThread()); 125 DCHECK(CalledOnValidThread());
126 if (gpu_channel_manager_) 126 if (gpu_channel_manager_)
127 gpu_channel_manager_->DestroyGpuMemoryBuffer(id, client_id, sync_token); 127 gpu_channel_manager_->DestroyGpuMemoryBuffer(id, client_id, sync_token);
128 } 128 }
129 129
130 void GpuService::GetVideoMemoryUsageStats(
131 const GetVideoMemoryUsageStatsCallback& callback) {
132 gpu::VideoMemoryUsageStats video_memory_usage_stats;
133 if (gpu_channel_manager_) {
134 gpu_channel_manager_->gpu_memory_manager()->GetVideoMemoryUsageStats(
135 &video_memory_usage_stats);
136 }
137 callback.Run(video_memory_usage_stats);
138 }
139
130 void GpuService::DidCreateOffscreenContext(const GURL& active_url) { 140 void GpuService::DidCreateOffscreenContext(const GURL& active_url) {
131 gpu_host_->DidCreateOffscreenContext(active_url); 141 gpu_host_->DidCreateOffscreenContext(active_url);
132 } 142 }
133 143
134 void GpuService::DidDestroyChannel(int client_id) { 144 void GpuService::DidDestroyChannel(int client_id) {
135 media_gpu_channel_manager_->RemoveChannel(client_id); 145 media_gpu_channel_manager_->RemoveChannel(client_id);
136 gpu_host_->DidDestroyChannel(client_id); 146 gpu_host_->DidDestroyChannel(client_id);
137 } 147 }
138 148
139 void GpuService::DidDestroyOffscreenContext(const GURL& active_url) { 149 void GpuService::DidDestroyOffscreenContext(const GURL& active_url) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 mojo::ScopedMessagePipeHandle channel_handle; 193 mojo::ScopedMessagePipeHandle channel_handle;
184 IPC::ChannelHandle handle = gpu_channel_manager_->EstablishChannel( 194 IPC::ChannelHandle handle = gpu_channel_manager_->EstablishChannel(
185 client_id, client_tracing_id, preempts, allow_view_command_buffers, 195 client_id, client_tracing_id, preempts, allow_view_command_buffers,
186 allow_real_time_streams); 196 allow_real_time_streams);
187 channel_handle.reset(handle.mojo_handle); 197 channel_handle.reset(handle.mojo_handle);
188 media_gpu_channel_manager_->AddChannel(client_id); 198 media_gpu_channel_manager_->AddChannel(client_id);
189 callback.Run(std::move(channel_handle)); 199 callback.Run(std::move(channel_handle));
190 } 200 }
191 201
192 } // namespace ui 202 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/gpu/gpu_service.h ('k') | services/ui/gpu/interfaces/gpu_service.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698