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

Side by Side Diff: include/v8.h

Issue 2756523004: WIP: Create a public v8::DictionarySchema API for bulk reads from dict objects.
Patch Set: Created 3 years, 9 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 | « no previous file | src/api.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project 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 /** \mainpage V8 API Reference Guide 5 /** \mainpage V8 API Reference Guide
6 * 6 *
7 * V8 is Google's open source JavaScript engine. 7 * V8 is Google's open source JavaScript engine.
8 * 8 *
9 * This set of documents provides reference material generated from the 9 * This set of documents provides reference material generated from the
10 * V8 header file, include/v8.h. 10 * V8 header file, include/v8.h.
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 friend Local<Primitive> Null(Isolate* isolate); 295 friend Local<Primitive> Null(Isolate* isolate);
296 friend Local<Boolean> True(Isolate* isolate); 296 friend Local<Boolean> True(Isolate* isolate);
297 friend Local<Boolean> False(Isolate* isolate); 297 friend Local<Boolean> False(Isolate* isolate);
298 friend class HandleScope; 298 friend class HandleScope;
299 friend class EscapableHandleScope; 299 friend class EscapableHandleScope;
300 template <class F1, class F2, class F3> 300 template <class F1, class F2, class F3>
301 friend class PersistentValueMapBase; 301 friend class PersistentValueMapBase;
302 template<class F1, class F2> friend class PersistentValueVector; 302 template<class F1, class F2> friend class PersistentValueVector;
303 template <class F> 303 template <class F>
304 friend class ReturnValue; 304 friend class ReturnValue;
305 friend class DictionarySchema;
305 306
306 explicit V8_INLINE Local(T* that) : val_(that) {} 307 explicit V8_INLINE Local(T* that) : val_(that) {}
307 V8_INLINE static Local<T> New(Isolate* isolate, T* that); 308 V8_INLINE static Local<T> New(Isolate* isolate, T* that);
308 T* val_; 309 T* val_;
309 }; 310 };
310 311
311 312
312 #if !defined(V8_IMMINENT_DEPRECATION_WARNINGS) 313 #if !defined(V8_IMMINENT_DEPRECATION_WARNINGS)
313 // Handle is an alias for Local for historical reasons. 314 // Handle is an alias for Local for historical reasons.
314 template <class T> 315 template <class T>
(...skipping 5259 matching lines...) Expand 10 before | Expand all | Expand 10 after
5574 class V8_EXPORT AccessorSignature : public Data { 5575 class V8_EXPORT AccessorSignature : public Data {
5575 public: 5576 public:
5576 static Local<AccessorSignature> New( 5577 static Local<AccessorSignature> New(
5577 Isolate* isolate, 5578 Isolate* isolate,
5578 Local<FunctionTemplate> receiver = Local<FunctionTemplate>()); 5579 Local<FunctionTemplate> receiver = Local<FunctionTemplate>());
5579 5580
5580 private: 5581 private:
5581 AccessorSignature(); 5582 AccessorSignature();
5582 }; 5583 };
5583 5584
5585 // --- Dictionary schema ---
5586
5587 /*
5588 * A DictionarySchema defines the keys expected to be present on a dictionary
5589 * object and provides an efficient way of reading them.
5590 */
5591 class V8_EXPORT DictionarySchema : public Data {
5592 public:
5593 static Local<DictionarySchema> New(Isolate* isolate, Local<Value> keys[],
5594 int keyCount);
5595
5596 enum ValueFilter {
5597 kValueFilterNone = 0,
5598 kValueFilterPrimitives = 1 << 0,
5599 kValueFilterObjects = 1 << 1,
5600 };
5601
5602 /*
5603 * Reads keys from the object according to the schema, in order.
5604 * Reading will abort if:
5605 * - an exception is thrown (Nothing<bool>() is returned)
5606 * - an object that doesn't match |continue_filter| is reached
5607 * (Just(false) is returned)
5608 * - all properties are read (Just(true) is returned)
5609 *
5610 * |index| will be updated to point to the next index left to be read;
5611 * this makes repeated invocations convenient.
5612 */
5613 Maybe<bool> Get(Local<Context> context, Local<Object> object,
5614 ValueFilter continue_filter, Local<Value>* out_values,
5615 int out_length, int* index);
5616 };
5584 5617
5585 // --- Extensions --- 5618 // --- Extensions ---
5586 5619
5587 class V8_EXPORT ExternalOneByteStringResourceImpl 5620 class V8_EXPORT ExternalOneByteStringResourceImpl
5588 : public String::ExternalOneByteStringResource { 5621 : public String::ExternalOneByteStringResource {
5589 public: 5622 public:
5590 ExternalOneByteStringResourceImpl() : data_(0), length_(0) {} 5623 ExternalOneByteStringResourceImpl() : data_(0), length_(0) {}
5591 ExternalOneByteStringResourceImpl(const char* data, size_t length) 5624 ExternalOneByteStringResourceImpl(const char* data, size_t length)
5592 : data_(data), length_(length) {} 5625 : data_(data), length_(length) {}
5593 const char* data() const { return data_; } 5626 const char* data() const { return data_; }
(...skipping 4237 matching lines...) Expand 10 before | Expand all | Expand 10 after
9831 */ 9864 */
9832 9865
9833 9866
9834 } // namespace v8 9867 } // namespace v8
9835 9868
9836 9869
9837 #undef TYPE_CHECK 9870 #undef TYPE_CHECK
9838 9871
9839 9872
9840 #endif // INCLUDE_V8_H_ 9873 #endif // INCLUDE_V8_H_
OLDNEW
« no previous file with comments | « no previous file | src/api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698