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

Side by Side Diff: gpu/ipc/id_type_traits.h

Issue 1548443002: Introducing gpu::CommandBufferId as a distinct, IdType<...>-based type. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@type-safe-save-package-id-self-contained
Patch Set: Rebasing... Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « gpu/ipc/gpu_command_buffer_traits.cc ('k') | media/base/video_frame_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 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.
4
5 #ifndef GPU_IPC_ID_TYPE_TRAITS_H_
6 #define GPU_IPC_ID_TYPE_TRAITS_H_
7
8 #include <string>
9
10 #include "base/pickle.h"
11 #include "gpu/command_buffer/common/id_type.h"
12 #include "ipc/ipc_message_utils.h"
13 #include "ipc/ipc_param_traits.h"
14
15 namespace IPC {
16
17 template <typename TypeMarker, typename WrappedType, WrappedType kInvalidValue>
18 struct ParamTraits<gpu::IdType<TypeMarker, WrappedType, kInvalidValue>> {
19 using param_type = gpu::IdType<TypeMarker, WrappedType, kInvalidValue>;
20 static void GetSize(base::PickleSizer* sizer, const param_type& p) {
21 GetParamSize(sizer, p.GetUnsafeValue());
22 }
23 static void Write(base::Pickle* m, const param_type& p) {
24 WriteParam(m, p.GetUnsafeValue());
25 }
26 static bool Read(const base::Pickle* m,
27 base::PickleIterator* iter,
28 param_type* r) {
29 WrappedType value;
30 if (!ReadParam(m, iter, &value))
31 return false;
32 *r = param_type::FromUnsafeValue(value);
33 return true;
34 }
35 static void Log(const param_type& p, std::string* l) {
36 LogParam(p.GetUnsafeValue(), l);
37 }
38 };
39
40 } // namespace IPC
41
42 #endif // GPU_IPC_ID_TYPE_TRAITS_H_
OLDNEW
« no previous file with comments | « gpu/ipc/gpu_command_buffer_traits.cc ('k') | media/base/video_frame_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698