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

Side by Side Diff: include/v8.h

Issue 435003: Patch for allowing several V8 instances in process:... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years 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 | « AUTHORS ('k') | samples/shell.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 2007-2009 the V8 project authors. All rights reserved. 1 // Copyright 2007-2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 template <class T> class Persistent; 125 template <class T> class Persistent;
126 class FunctionTemplate; 126 class FunctionTemplate;
127 class ObjectTemplate; 127 class ObjectTemplate;
128 class Data; 128 class Data;
129 129
130 namespace internal { 130 namespace internal {
131 131
132 class Arguments; 132 class Arguments;
133 class Object; 133 class Object;
134 class Top; 134 class Top;
135 class V8Context;
135 136
136 } 137 }
137 138
138 139
139 // --- W e a k H a n d l e s 140 // --- W e a k H a n d l e s
140 141
141 142
142 /** 143 /**
143 * A weak reference callback function. 144 * A weak reference callback function.
144 * 145 *
(...skipping 2609 matching lines...) Expand 10 before | Expand all | Expand 10 after
2754 static void StopPreemption(); 2755 static void StopPreemption();
2755 2756
2756 /** 2757 /**
2757 * Returns whether or not the locker is locked by the current thread. 2758 * Returns whether or not the locker is locked by the current thread.
2758 */ 2759 */
2759 static bool IsLocked(); 2760 static bool IsLocked();
2760 2761
2761 /** 2762 /**
2762 * Returns whether v8::Locker is being used by this V8 instance. 2763 * Returns whether v8::Locker is being used by this V8 instance.
2763 */ 2764 */
2764 static bool IsActive() { return active_; } 2765 static bool IsActive();
2765 2766
2766 private: 2767 private:
2767 bool has_lock_; 2768 bool has_lock_;
2768 bool top_level_; 2769 bool top_level_;
2769 2770
2770 static bool active_;
2771
2772 // Disallow copying and assigning. 2771 // Disallow copying and assigning.
2773 Locker(const Locker&); 2772 Locker(const Locker&);
2774 void operator=(const Locker&); 2773 void operator=(const Locker&);
2775 }; 2774 };
2776 2775
2777 2776
2778 2777
2779 // --- I m p l e m e n t a t i o n --- 2778 // --- I m p l e m e n t a t i o n ---
2780 2779
2781 2780
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
3200 return Local<Object>(reinterpret_cast<Object*>(&args_[0])); 3199 return Local<Object>(reinterpret_cast<Object*>(&args_[0]));
3201 } 3200 }
3202 3201
3203 3202
3204 Local<Object> AccessorInfo::Holder() const { 3203 Local<Object> AccessorInfo::Holder() const {
3205 return Local<Object>(reinterpret_cast<Object*>(&args_[-1])); 3204 return Local<Object>(reinterpret_cast<Object*>(&args_[-1]));
3206 } 3205 }
3207 3206
3208 3207
3209 /** 3208 /**
3209 * Encapsulates V8 instance
3210 */
3211 class V8EXPORT V8ContextProvider {
3212 public:
3213 V8ContextProvider();
3214 ~V8ContextProvider();
3215
3216 operator internal::V8Context*() const {
3217 return v8context_;
3218 }
3219 private:
3220 V8ContextProvider(const V8ContextProvider&);
3221 void operator=(const V8ContextProvider&);
3222 void* operator new(size_t size);
3223 void operator delete(void*, size_t);
3224
3225 internal::V8Context* const v8context_;
3226 friend class V8ContextBinder;
3227 };
3228
3229 /**
3230 * Manages binding of V8 instance (from V8ContextProvider) to current thread
3231 *
3232 * V8ContextProvider context_provider;
3233 * ...
3234 * V8ContextBinder context_binder(context_provider);
3235 */
3236 class V8EXPORT V8ContextBinder {
3237 public:
3238 V8ContextBinder(internal::V8Context*, bool bind_default = false);
3239 ~V8ContextBinder();
3240 private:
3241 V8ContextBinder(const V8ContextBinder&);
3242 void operator=(const V8ContextBinder&);
3243 void* operator new(size_t size);
3244 void operator delete(void*, size_t);
3245
3246 internal::V8Context* const v8context_;
3247 bool bound_default_;
3248 };
3249
3250 /**
3251 * Allocated statically, implies intent of V8 host to have several instances
3252 * of V8 in process
3253 */
3254 class V8EXPORT AllowSeveralV8InstancesInProcess {
3255 public:
3256 AllowSeveralV8InstancesInProcess();
3257 ~AllowSeveralV8InstancesInProcess();
3258 };
3259
3260 /**
3210 * \example shell.cc 3261 * \example shell.cc
3211 * A simple shell that takes a list of expressions on the 3262 * A simple shell that takes a list of expressions on the
3212 * command-line and executes them. 3263 * command-line and executes them.
3213 */ 3264 */
3214 3265
3215 3266
3216 /** 3267 /**
3217 * \example process.cc 3268 * \example process.cc
3218 */ 3269 */
3219 3270
3220 3271
3221 } // namespace v8 3272 } // namespace v8
3222 3273
3223 3274
3224 #undef V8EXPORT 3275 #undef V8EXPORT
3225 #undef V8EXPORT_INLINE 3276 #undef V8EXPORT_INLINE
3226 #undef TYPE_CHECK 3277 #undef TYPE_CHECK
3227 3278
3228 3279
3229 #endif // V8_H_ 3280 #endif // V8_H_
OLDNEW
« no previous file with comments | « AUTHORS ('k') | samples/shell.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698