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

Unified Diff: gpu/ipc/gpu_command_buffer_traits.cc

Issue 1399173002: Reland: Added SyncToken command buffer trait to help with IPC messages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Read/Write SyncToken variables separately. Created 5 years, 2 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/ipc/gpu_command_buffer_traits.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/ipc/gpu_command_buffer_traits.cc
diff --git a/gpu/ipc/gpu_command_buffer_traits.cc b/gpu/ipc/gpu_command_buffer_traits.cc
index ed43cd29d57dd8cee214057921d25b3bb426af61..6a77984f8e44c5ab8327143a749f31857d716cf3 100644
--- a/gpu/ipc/gpu_command_buffer_traits.cc
+++ b/gpu/ipc/gpu_command_buffer_traits.cc
@@ -5,6 +5,7 @@
#include "gpu/ipc/gpu_command_buffer_traits.h"
#include "gpu/command_buffer/common/mailbox_holder.h"
+#include "gpu/command_buffer/common/sync_token.h"
#include "gpu/command_buffer/common/value_state.h"
// Generate param traits write methods.
@@ -55,6 +56,44 @@ void ParamTraits<gpu::CommandBuffer::State> ::Log(const param_type& p,
l->append("<CommandBuffer::State>");
}
+void ParamTraits<gpu::SyncToken>::Write(Message* m, const param_type& p) {
+ const int namespace_id = static_cast<int>(p.namespace_id());
+ const uint64_t command_buffer_id = p.command_buffer_id();
+ const uint64_t release_count = p.release_count();
+
+ m->WriteBytes(&namespace_id, sizeof(namespace_id));
+ m->WriteBytes(&command_buffer_id, sizeof(command_buffer_id));
+ m->WriteBytes(&release_count, sizeof(release_count));
+}
+
+bool ParamTraits<gpu::SyncToken>::Read(const Message* m,
+ base::PickleIterator* iter,
+ param_type* p) {
+ int namespace_id = -1;
+ if (!iter->ReadInt(&namespace_id))
+ return false;
+
+ uint64_t command_buffer_id = 0;
+ if (!iter->ReadUInt64(&command_buffer_id))
+ return false;
+
+ uint64_t release_count = 0;
+ if (!iter->ReadUInt64(&release_count))
+ return false;
+
+ p->Set(static_cast<gpu::CommandBufferNamespace>(namespace_id),
+ command_buffer_id,
+ release_count);
+ return true;
+}
+
+void ParamTraits<gpu::SyncToken>::Log(const param_type& p, std::string* l) {
+ *l +=
+ base::StringPrintf("[%d:%llX] %llu", static_cast<int>(p.namespace_id()),
+ static_cast<unsigned long long>(p.command_buffer_id()),
+ static_cast<unsigned long long>(p.release_count()));
+}
+
void ParamTraits<gpu::Mailbox>::Write(Message* m, const param_type& p) {
m->WriteBytes(p.name, sizeof(p.name));
}
« no previous file with comments | « gpu/ipc/gpu_command_buffer_traits.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698