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

Unified Diff: services/ui/gpu/gpu_service.cc

Issue 2801723002: GpuService: introduce GetGpuMemoryBufferAttribs as a mojo interface
Patch Set: GpuService: introduce GetGpuMemoryBufferAttribs as a mojo interface Created 3 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/gpu/gpu_service.cc
diff --git a/services/ui/gpu/gpu_service.cc b/services/ui/gpu/gpu_service.cc
index 03c8823b173a4a67a5d29dfcc68e03b1f5a9d8e0..d0a2059365743da0c82eb299cf5fb2e216a8209f 100644
--- a/services/ui/gpu/gpu_service.cc
+++ b/services/ui/gpu/gpu_service.cc
@@ -241,6 +241,33 @@ void GpuService::DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
gpu_channel_manager_->DestroyGpuMemoryBuffer(id, client_id, sync_token);
}
+void GpuService::GetGpuMemoryBufferAttribs(
+ const GetGpuMemoryBufferAttribsCallback& callback) {
+ gfx::GpuMemoryBufferAttribVector supported_attribs;
+
+ for (int i = 0; i < static_cast<int>(gfx::BufferUsage::LAST); i++) {
+ gfx::GpuMemoryBufferAttribVector tmp =
+ gpu_memory_buffer_factory_->GetSupportedGpuMemoryBufferAttribsForUsage(
+ static_cast<gfx::BufferUsage>(i));
+ if (tmp.size() == 0)
+ continue;
+
+ gfx::GpuMemoryBufferAttribVector intersection;
+ std::sort(tmp.begin(), tmp.end());
+
+ if (supported_attribs.size() == 0)
+ supported_attribs = std::move(tmp);
+ else {
+ std::set_intersection(supported_attribs.begin(), supported_attribs.end(),
+ tmp.begin(), tmp.end(),
+ std::back_inserter(intersection));
+ supported_attribs = std::move(intersection);
+ }
+ }
+
+ callback.Run(supported_attribs);
sadrul 2017/04/19 21:40:23 Do we expect this list to change between requests?
varad 2017/04/21 13:01:32 Done.
+}
+
void GpuService::GetVideoMemoryUsageStats(
const GetVideoMemoryUsageStatsCallback& callback) {
if (io_runner_->BelongsToCurrentThread()) {
« 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