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

Side by Side Diff: include/v8.h

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