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

Unified Diff: mojo/public/cpp/bindings/lib/array_serialization.h

Issue 2045723002: mojo ArrayTraits<T>::Resize returns bool indicating success (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed pach Created 4 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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/cpp/bindings/lib/array_serialization.h
diff --git a/mojo/public/cpp/bindings/lib/array_serialization.h b/mojo/public/cpp/bindings/lib/array_serialization.h
index 158056871bcf37abd74aa984bac45c70151bd41f..99e93e221921f0adc9d90dced5575070c99fa620 100644
--- a/mojo/public/cpp/bindings/lib/array_serialization.h
+++ b/mojo/public/cpp/bindings/lib/array_serialization.h
@@ -137,7 +137,8 @@ struct ArraySerializer<MojomType,
static bool DeserializeElements(Data* input,
UserType* output,
SerializationContext* context) {
- Traits::Resize(*output, input->size());
+ if (!Traits::Resize(*output, input->size()))
+ return false;
if (input->size()) {
auto data = CallGetDataIfExists<Traits>(*output);
if (data) {
@@ -188,7 +189,8 @@ struct ArraySerializer<MojomType,
static bool DeserializeElements(Data* input,
UserType* output,
SerializationContext* context) {
- Traits::Resize(*output, input->size());
+ if (!Traits::Resize(*output, input->size()))
+ return false;
for (size_t i = 0; i < input->size(); ++i)
Traits::GetAt(*output, i) = input->at(i);
return true;
@@ -240,7 +242,8 @@ struct ArraySerializer<MojomType,
UserType* output,
SerializationContext* context) {
using HandleType = typename Element::RawHandleType;
- Traits::Resize(*output, input->size());
+ if (!Traits::Resize(*output, input->size()))
+ return false;
for (size_t i = 0; i < input->size(); ++i) {
Traits::GetAt(*output, i) = MakeScopedHandle(
HandleType(context->handles.TakeHandle(input->at(i)).value()));
@@ -299,7 +302,8 @@ struct ArraySerializer<MojomType,
UserType* output,
SerializationContext* context) {
bool success = true;
- Traits::Resize(*output, input->size());
+ if (!Traits::Resize(*output, input->size()))
+ return false;
for (size_t i = 0; i < input->size(); ++i) {
// Note that we rely on complete deserialization taking place in order to
// transfer ownership of all encoded handles. Therefore we don't
@@ -391,7 +395,8 @@ struct ArraySerializer<MojomType,
UserType* output,
SerializationContext* context) {
bool success = true;
- Traits::Resize(*output, input->size());
+ if (!Traits::Resize(*output, input->size()))
+ return false;
for (size_t i = 0; i < input->size(); ++i) {
// Note that we rely on complete deserialization taking place in order to
// transfer ownership of all encoded handles. Therefore we don't
« no previous file with comments | « mojo/public/cpp/bindings/array_traits_wtf_vector.h ('k') | skia/public/interfaces/bitmap_skbitmap_struct_traits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698