1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "gpu/command_buffer/service/gpu_control_service.h"
7 #include "gpu/command_buffer/service/gpu_memory_buffer_manager.h"
8 #include "gpu/command_buffer/service/query_manager.h"
12 GpuControlService::GpuControlService(
13 GpuMemoryBufferManagerInterface
* gpu_memory_buffer_manager
,
14 gles2::QueryManager
* query_manager
)
15 : gpu_memory_buffer_manager_(gpu_memory_buffer_manager
),
16 query_manager_(query_manager
) {
19 GpuControlService::~GpuControlService() {
22 void GpuControlService::SignalQuery(uint32 query_id
,
23 const base::Closure
& callback
) {
24 DCHECK(query_manager_
);
25 gles2::QueryManager::Query
* query
= query_manager_
->GetQuery(query_id
);
29 query
->AddCallback(callback
);
32 void GpuControlService::RegisterGpuMemoryBuffer(
34 gfx::GpuMemoryBufferHandle buffer
,
37 unsigned internalformat
) {
38 gpu_memory_buffer_manager_
->RegisterGpuMemoryBuffer(
39 id
, buffer
, width
, height
, internalformat
);
42 void GpuControlService::UnregisterGpuMemoryBuffer(int32 id
) {
43 gpu_memory_buffer_manager_
->UnregisterGpuMemoryBuffer(id
);