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

Side by Side Diff: include/v8.h

Issue 583153002: Reland 24052 - Require V8 to be explicitly initialized before an Isolate is created (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 | samples/lineprocessor.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 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 4326 matching lines...) Expand 10 before | Expand all | Expand 10 after
4337 4337
4338 /** 4338 /**
4339 * Callback function passed to SetJitCodeEventHandler. 4339 * Callback function passed to SetJitCodeEventHandler.
4340 * 4340 *
4341 * \param event code add, move or removal event. 4341 * \param event code add, move or removal event.
4342 */ 4342 */
4343 typedef void (*JitCodeEventHandler)(const JitCodeEvent* event); 4343 typedef void (*JitCodeEventHandler)(const JitCodeEvent* event);
4344 4344
4345 4345
4346 /** 4346 /**
4347 * Isolate represents an isolated instance of the V8 engine. V8 4347 * Isolate represents an isolated instance of the V8 engine. V8 isolates have
4348 * isolates have completely separate states. Objects from one isolate 4348 * completely separate states. Objects from one isolate must not be used in
4349 * must not be used in other isolates. When V8 is initialized a 4349 * other isolates. The embedder can create multiple isolates and use them in
4350 * default isolate is implicitly created and entered. The embedder 4350 * parallel in multiple threads. An isolate can be entered by at most one
4351 * can create additional isolates and use them in parallel in multiple 4351 * thread at any given time. The Locker/Unlocker API must be used to
4352 * threads. An isolate can be entered by at most one thread at any 4352 * synchronize.
4353 * given time. The Locker/Unlocker API must be used to synchronize.
4354 */ 4353 */
4355 class V8_EXPORT Isolate { 4354 class V8_EXPORT Isolate {
4356 public: 4355 public:
4357 /** 4356 /**
4358 * Initial configuration parameters for a new Isolate. 4357 * Initial configuration parameters for a new Isolate.
4359 */ 4358 */
4360 struct CreateParams { 4359 struct CreateParams {
4361 CreateParams() : entry_hook(NULL), code_event_handler(NULL) {} 4360 CreateParams()
4361 : entry_hook(NULL),
4362 code_event_handler(NULL),
4363 enable_serializer(false) {}
4362 4364
4363 /** 4365 /**
4364 * The optional entry_hook allows the host application to provide the 4366 * The optional entry_hook allows the host application to provide the
4365 * address of a function that's invoked on entry to every V8-generated 4367 * address of a function that's invoked on entry to every V8-generated
4366 * function. Note that entry_hook is invoked at the very start of each 4368 * function. Note that entry_hook is invoked at the very start of each
4367 * generated function. Furthermore, if an entry_hook is given, V8 will 4369 * generated function. Furthermore, if an entry_hook is given, V8 will
4368 * always run without a context snapshot. 4370 * always run without a context snapshot.
4369 */ 4371 */
4370 FunctionEntryHook entry_hook; 4372 FunctionEntryHook entry_hook;
4371 4373
4372 /** 4374 /**
4373 * Allows the host application to provide the address of a function that is 4375 * Allows the host application to provide the address of a function that is
4374 * notified each time code is added, moved or removed. 4376 * notified each time code is added, moved or removed.
4375 */ 4377 */
4376 JitCodeEventHandler code_event_handler; 4378 JitCodeEventHandler code_event_handler;
4377 4379
4378 /** 4380 /**
4379 * ResourceConstraints to use for the new Isolate. 4381 * ResourceConstraints to use for the new Isolate.
4380 */ 4382 */
4381 ResourceConstraints constraints; 4383 ResourceConstraints constraints;
4384
4385 /**
4386 * This flag currently renders the Isolate unusable.
4387 */
4388 bool enable_serializer;
4382 }; 4389 };
4383 4390
4384 4391
4385 /** 4392 /**
4386 * Stack-allocated class which sets the isolate for all operations 4393 * Stack-allocated class which sets the isolate for all operations
4387 * executed within a local scope. 4394 * executed within a local scope.
4388 */ 4395 */
4389 class V8_EXPORT Scope { 4396 class V8_EXPORT Scope {
4390 public: 4397 public:
4391 explicit Scope(Isolate* isolate) : isolate_(isolate) { 4398 explicit Scope(Isolate* isolate) : isolate_(isolate) {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
4482 typedef void (*UseCounterCallback)(Isolate* isolate, 4489 typedef void (*UseCounterCallback)(Isolate* isolate,
4483 UseCounterFeature feature); 4490 UseCounterFeature feature);
4484 4491
4485 4492
4486 /** 4493 /**
4487 * Creates a new isolate. Does not change the currently entered 4494 * Creates a new isolate. Does not change the currently entered
4488 * isolate. 4495 * isolate.
4489 * 4496 *
4490 * When an isolate is no longer used its resources should be freed 4497 * When an isolate is no longer used its resources should be freed
4491 * by calling Dispose(). Using the delete operator is not allowed. 4498 * by calling Dispose(). Using the delete operator is not allowed.
4499 *
4500 * V8::Initialize() must have run prior to this.
4492 */ 4501 */
4493 static Isolate* New(const CreateParams& params = CreateParams()); 4502 static Isolate* New(const CreateParams& params = CreateParams());
4494 4503
4495 /** 4504 /**
4496 * Returns the entered isolate for the current thread or NULL in 4505 * Returns the entered isolate for the current thread or NULL in
4497 * case there is no current isolate. 4506 * case there is no current isolate.
4498 */ 4507 */
4499 static Isolate* GetCurrent(); 4508 static Isolate* GetCurrent();
4500 4509
4501 /** 4510 /**
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
5095 static void AddMemoryAllocationCallback(MemoryAllocationCallback callback, 5104 static void AddMemoryAllocationCallback(MemoryAllocationCallback callback,
5096 ObjectSpace space, 5105 ObjectSpace space,
5097 AllocationAction action); 5106 AllocationAction action);
5098 5107
5099 /** 5108 /**
5100 * Removes callback that was installed by AddMemoryAllocationCallback. 5109 * Removes callback that was installed by AddMemoryAllocationCallback.
5101 */ 5110 */
5102 static void RemoveMemoryAllocationCallback(MemoryAllocationCallback callback); 5111 static void RemoveMemoryAllocationCallback(MemoryAllocationCallback callback);
5103 5112
5104 /** 5113 /**
5105 * Initializes from snapshot if possible. Otherwise, attempts to 5114 * Initializes V8. This function needs to be called before the first Isolate
5106 * initialize from scratch. This function is called implicitly if 5115 * is created. It always returns true.
5107 * you use the API without calling it first.
5108 */ 5116 */
5109 static bool Initialize(); 5117 static bool Initialize();
5110 5118
5111 /** 5119 /**
5112 * Allows the host application to provide a callback which can be used 5120 * Allows the host application to provide a callback which can be used
5113 * as a source of entropy for random number generators. 5121 * as a source of entropy for random number generators.
5114 */ 5122 */
5115 static void SetEntropySource(EntropySource source); 5123 static void SetEntropySource(EntropySource source);
5116 5124
5117 /** 5125 /**
(...skipping 1877 matching lines...) Expand 10 before | Expand all | Expand 10 after
6995 */ 7003 */
6996 7004
6997 7005
6998 } // namespace v8 7006 } // namespace v8
6999 7007
7000 7008
7001 #undef TYPE_CHECK 7009 #undef TYPE_CHECK
7002 7010
7003 7011
7004 #endif // V8_H_ 7012 #endif // V8_H_
OLDNEW
« no previous file with comments | « no previous file | samples/lineprocessor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698