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

Side by Side Diff: mojo/public/cpp/bindings/lib/bindings_serialization.h

Issue 328183002: More clear comment for ValidateStructHeader. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | mojo/public/cpp/bindings/lib/bindings_serialization.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_SERIALIZATION_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_SERIALIZATION_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_SERIALIZATION_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_SERIALIZATION_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "mojo/public/cpp/system/core.h" 10 #include "mojo/public/cpp/system/core.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 // Note: This function doesn't validate the encoded pointer and handle values. 64 // Note: This function doesn't validate the encoded pointer and handle values.
65 template <typename T> 65 template <typename T>
66 inline void Decode(T* obj, std::vector<Handle>* handles) { 66 inline void Decode(T* obj, std::vector<Handle>* handles) {
67 DecodePointer(&obj->offset, &obj->ptr); 67 DecodePointer(&obj->offset, &obj->ptr);
68 if (obj->ptr) 68 if (obj->ptr)
69 obj->ptr->DecodePointersAndHandles(handles); 69 obj->ptr->DecodePointersAndHandles(handles);
70 } 70 }
71 71
72 // If returns true, this function also claims the memory range of the size 72 // If returns true, this function also claims the memory range of the size
73 // specified in the struct header, starting from |data|. 73 // specified in the struct header, starting from |data|.
74 // Note: |min_num_bytes| must be no less than sizeof(StructHeader).
74 bool ValidateStructHeader(const void* data, 75 bool ValidateStructHeader(const void* data,
75 uint32_t min_num_bytes, 76 uint32_t min_num_bytes,
76 uint32_t min_num_fields, 77 uint32_t min_num_fields,
77 BoundsChecker* bounds_checker); 78 BoundsChecker* bounds_checker);
78 79
79 } // namespace internal 80 } // namespace internal
80 } // namespace mojo 81 } // namespace mojo
81 82
82 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_SERIALIZATION_H_ 83 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_SERIALIZATION_H_
OLDNEW
« no previous file with comments | « no previous file | mojo/public/cpp/bindings/lib/bindings_serialization.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698