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

Side by Side Diff: Source/bindings/core/v8/V8BindingMacros.h

Issue 1091543002: IDL: Add [FlexibleArrayBufferView] and use for bufferSubData Base URL: https://chromium.googlesource.com/chromium/blink.git@idl-includes-for-type-tuning
Patch Set: add warning about the storage's life-time Created 5 years, 8 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 | « Source/bindings/core/v8/V8Binding.cpp ('k') | Source/bindings/scripts/v8_types.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 #define TOSTRING_VOID(type, var, value) \ 70 #define TOSTRING_VOID(type, var, value) \
71 type var(value); \ 71 type var(value); \
72 if (UNLIKELY(!var.prepare())) \ 72 if (UNLIKELY(!var.prepare())) \
73 return; 73 return;
74 74
75 #define TOSTRING_DEFAULT(type, var, value, retVal) \ 75 #define TOSTRING_DEFAULT(type, var, value, retVal) \
76 type var(value); \ 76 type var(value); \
77 if (UNLIKELY(!var.prepare())) \ 77 if (UNLIKELY(!var.prepare())) \
78 return retVal; 78 return retVal;
79 79
80 #define SMALL_ARRAY_BUFFER_VIEW_STORAGE(value) \
81 (value->IsArrayBufferView() && !value.As<v8::ArrayBufferView>()->HasBuffer() ? alloca(value.As<v8::ArrayBufferView>()->ByteLength()) : nullptr)
82
80 template <typename T> 83 template <typename T>
81 inline bool v8Call(v8::Maybe<T> maybe, T& outVariable) 84 inline bool v8Call(v8::Maybe<T> maybe, T& outVariable)
82 { 85 {
83 if (maybe.IsNothing()) 86 if (maybe.IsNothing())
84 return false; 87 return false;
85 outVariable = maybe.FromJust(); 88 outVariable = maybe.FromJust();
86 return true; 89 return true;
87 } 90 }
88 91
89 inline bool v8CallBoolean(v8::Maybe<bool> maybe) 92 inline bool v8CallBoolean(v8::Maybe<bool> maybe)
(...skipping 20 matching lines...) Expand all
110 113
111 // The last "else" is to avoid dangling else problem. 114 // The last "else" is to avoid dangling else problem.
112 #define V8_CALL(outVariable, handle, methodCall, failureExpression) \ 115 #define V8_CALL(outVariable, handle, methodCall, failureExpression) \
113 if (handle.IsEmpty() || !v8Call(handle->methodCall, outVariable)) { \ 116 if (handle.IsEmpty() || !v8Call(handle->methodCall, outVariable)) { \
114 failureExpression; \ 117 failureExpression; \
115 } else 118 } else
116 119
117 } // namespace blink 120 } // namespace blink
118 121
119 #endif // V8BindingMacros_h 122 #endif // V8BindingMacros_h
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/V8Binding.cpp ('k') | Source/bindings/scripts/v8_types.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698