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

Side by Side Diff: include/v8.h

Issue 606053: Enable passing of script data via script creation methods (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: '' Created 10 years, 10 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 | src/api.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 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 Handle<Integer> resource_column_offset_; 527 Handle<Integer> resource_column_offset_;
528 }; 528 };
529 529
530 530
531 /** 531 /**
532 * A compiled JavaScript script. 532 * A compiled JavaScript script.
533 */ 533 */
534 class V8EXPORT Script { 534 class V8EXPORT Script {
535 public: 535 public:
536 536
537 /**
538 * Compiles the specified script. The ScriptOrigin* and ScriptData*
539 * parameters are owned by the caller of Script::Compile. No
540 * references to these objects are kept after compilation finishes.
541 *
542 * The script object returned is context independent; when run it
543 * will use the currently entered context.
544 */
545 static Local<Script> New(Handle<String> source,
546 ScriptOrigin* origin = NULL,
547 ScriptData* pre_data = NULL);
548
549 /**
550 * Compiles the specified script using the specified file name
551 * object (typically a string) as the script's origin.
552 *
553 * The script object returned is context independent; when run it
554 * will use the currently entered context.
555 */
556 static Local<Script> New(Handle<String> source,
557 Handle<Value> file_name);
558
559 /** 537 /**
560 * Compiles the specified script. The ScriptOrigin* and ScriptData* 538 * Compiles the specified script (context-independent).
561 * parameters are owned by the caller of Script::Compile. No
562 * references to these objects are kept after compilation finishes.
563 * 539 *
564 * The script object returned is bound to the context that was active 540 * \param source Script source code.
565 * when this function was called. When run it will always use this 541 * \param origin Script origin, owned by caller, no references are kept
566 * context. 542 * when New() returns
543 * \param pre_data Pre-parsing data, as obtained by ScriptData::PreCompile()
544 * using pre_data speeds compilation if it's done multiple times.
545 * Owned by caller, no references are kept when New() returns.
546 * \param script_data Arbitrary data associated with script. Using
547 * this has same effect as calling SetData(), but allows data to be
548 * available to compile event handlers.
549 * \return Compiled script object (context independent; when run it
550 * will use the currently entered context).
567 */ 551 */
568 static Local<Script> Compile(Handle<String> source, 552 static Local<Script> New(Handle<String> source,
569 ScriptOrigin* origin = NULL, 553 ScriptOrigin* origin = NULL,
570 ScriptData* pre_data = NULL); 554 ScriptData* pre_data = NULL,
555 Handle<String> script_data = Handle<String>());
571 556
572 /** 557 /**
573 * Compiles the specified script using the specified file name 558 * Compiles the specified script using the specified file name
574 * object (typically a string) as the script's origin. 559 * object (typically a string) as the script's origin.
575 * 560 *
576 * The script object returned is bound to the context that was active 561 * \param source Script source code.
577 * when this function was called. When run it will always use this 562 * \patam file_name file name object (typically a string) to be used
578 * context. 563 * as the script's origin.
564 * \return Compiled script object (context independent; when run it
565 * will use the currently entered context).
566 */
567 static Local<Script> New(Handle<String> source,
568 Handle<Value> file_name);
569
570 /**
571 * Compiles the specified script (bound to current context).
572 *
573 * \param source Script source code.
574 * \param origin Script origin, owned by caller, no references are kept
575 * when Compile() returns
576 * \param pre_data Pre-parsing data, as obtained by ScriptData::PreCompile()
577 * using pre_data speeds compilation if it's done multiple times.
578 * Owned by caller, no references are kept when Compile() returns.
579 * \param script_data Arbitrary data associated with script. Using
580 * this has same effect as calling SetData(), but makes data available
581 * earlier (i.e. to compile event handlers).
582 * \return Compiled script object, bound to the context that was active
583 * when this function was called. When run it will always use this
584 * context.
579 */ 585 */
580 static Local<Script> Compile(Handle<String> source, 586 static Local<Script> Compile(Handle<String> source,
581 Handle<Value> file_name); 587 ScriptOrigin* origin = NULL,
588 ScriptData* pre_data = NULL,
589 Handle<String> script_data = Handle<String>());
590
591 /**
592 * Compiles the specified script using the specified file name
593 * object (typically a string) as the script's origin.
594 *
595 * \param source Script source code.
596 * \param file_name File name to use as script's origin
597 * \param script_data Arbitrary data associated with script. Using
598 * this has same effect as calling SetData(), but makes data available
599 * earlier (i.e. to compile event handlers).
600 * \return Compiled script object, bound to the context that was active
601 * when this function was called. When run it will always use this
602 * context.
603 */
604 static Local<Script> Compile(Handle<String> source,
605 Handle<Value> file_name,
606 Handle<String> script_data = Handle<String>());
582 607
583 /** 608 /**
584 * Runs the script returning the resulting value. If the script is 609 * Runs the script returning the resulting value. If the script is
585 * context independent (created using ::New) it will be run in the 610 * context independent (created using ::New) it will be run in the
586 * currently entered context. If it is context specific (created 611 * currently entered context. If it is context specific (created
587 * using ::Compile) it will be run in the context in which it was 612 * using ::Compile) it will be run in the context in which it was
588 * compiled. 613 * compiled.
589 */ 614 */
590 Local<Value> Run(); 615 Local<Value> Run();
591 616
(...skipping 2635 matching lines...) Expand 10 before | Expand all | Expand 10 after
3227 3252
3228 } // namespace v8 3253 } // namespace v8
3229 3254
3230 3255
3231 #undef V8EXPORT 3256 #undef V8EXPORT
3232 #undef V8EXPORT_INLINE 3257 #undef V8EXPORT_INLINE
3233 #undef TYPE_CHECK 3258 #undef TYPE_CHECK
3234 3259
3235 3260
3236 #endif // V8_H_ 3261 #endif // V8_H_
OLDNEW
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698