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

Unified Diff: gpu/command_buffer/common/buffer.cc

Issue 2012533004: Add generated and hand-written passthrough command handlers with stub Doers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
Index: gpu/command_buffer/common/buffer.cc
diff --git a/gpu/command_buffer/common/buffer.cc b/gpu/command_buffer/common/buffer.cc
index 1bb9523079dd3c094685b9ad306df7697b7526eb..9e8d5a0962bda741f5f62a4ba15bfd30b9d65cdc 100644
--- a/gpu/command_buffer/common/buffer.cc
+++ b/gpu/command_buffer/common/buffer.cc
@@ -43,6 +43,21 @@ void* Buffer::GetDataAddress(uint32_t data_offset, uint32_t data_size) const {
return static_cast<uint8_t*>(memory_) + data_offset;
}
+void* Buffer::GetDataAddressAndSize(uint32_t data_offset,
+ uint32_t* data_size) const {
+ if (data_offset > static_cast<uint32_t>(size_))
+ return NULL;
+ *data_size = GetRemainingSize(data_offset);
+ return static_cast<uint8_t*>(memory_) + data_offset;
+}
+
+uint32_t Buffer::GetRemainingSize(uint32_t data_offset) const {
+ base::CheckedNumeric<uint32_t> offset = data_offset;
+ if (!offset.IsValid() || offset.ValueOrDie() > static_cast<uint32_t>(size_))
piman 2016/05/25 23:34:42 Not sure of the goal of the offset.IsValid() check
Geoff Lang 2016/05/27 14:31:28 Whoops, yes, forgot to remove the CheckedNumerics
+ return 0;
+ return static_cast<uint32_t>(size_) - data_offset;
+}
+
base::trace_event::MemoryAllocatorDumpGuid GetBufferGUIDForTracing(
uint64_t tracing_process_id,
int32_t buffer_id) {

Powered by Google App Engine
This is Rietveld 408576698