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

Unified Diff: gpu/command_buffer/service/command_buffer_service.cc

Issue 2150803003: Introduce gpu_fuzzer to fuzz the GPU command buffers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fuzzer_land_base
Patch Set: Fix check, zero-out padding Created 4 years, 5 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 | « gpu/command_buffer/service/command_buffer_service.h ('k') | gpu/command_buffer/service/common_decoder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/command_buffer_service.cc
diff --git a/gpu/command_buffer/service/command_buffer_service.cc b/gpu/command_buffer/service/command_buffer_service.cc
index 679a24b5d6dc793d847c9fdb7ca98eb5ec66585e..e91a386bd5f479b2e64ad70ba312711230b24e0d 100644
--- a/gpu/command_buffer/service/command_buffer_service.cc
+++ b/gpu/command_buffer/service/command_buffer_service.cc
@@ -138,19 +138,12 @@ void CommandBufferService::SetGetOffset(int32_t get_offset) {
scoped_refptr<Buffer> CommandBufferService::CreateTransferBuffer(size_t size,
int32_t* id) {
- *id = -1;
static int32_t next_id = 1;
*id = next_id++;
-
- if (!RegisterTransferBuffer(*id,
- base::MakeUnique<MemoryBufferBacking>(size))) {
- if (error_ == error::kNoError)
- error_ = gpu::error::kOutOfBounds;
+ auto result = CreateTransferBufferWithId(size, *id);
+ if (!result)
*id = -1;
- return NULL;
- }
-
- return GetTransferBuffer(*id);
+ return result;
}
void CommandBufferService::DestroyTransferBuffer(int32_t id) {
@@ -175,6 +168,20 @@ bool CommandBufferService::RegisterTransferBuffer(
std::move(buffer));
}
+scoped_refptr<Buffer> CommandBufferService::CreateTransferBufferWithId(
+ size_t size,
+ int32_t id) {
+ if (!RegisterTransferBuffer(id,
+ base::MakeUnique<MemoryBufferBacking>(size))) {
+ if (error_ == error::kNoError)
+ error_ = gpu::error::kOutOfBounds;
+ return NULL;
+ }
+
+ return GetTransferBuffer(id);
+}
+
+
void CommandBufferService::SetToken(int32_t token) {
token_ = token;
UpdateState();
« no previous file with comments | « gpu/command_buffer/service/command_buffer_service.h ('k') | gpu/command_buffer/service/common_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698