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

Side by Side Diff: include/v8.h

Issue 181113008: Revert "Remove Script::SetData and the script_data parameter from Script::(Compile|New)." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/accessors.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 // 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 993 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 public: 1004 public:
1005 /** 1005 /**
1006 * Compiles the specified script (context-independent). 1006 * Compiles the specified script (context-independent).
1007 * 1007 *
1008 * \param source Script source code. 1008 * \param source Script source code.
1009 * \param origin Script origin, owned by caller, no references are kept 1009 * \param origin Script origin, owned by caller, no references are kept
1010 * when New() returns 1010 * when New() returns
1011 * \param pre_data Pre-parsing data, as obtained by ScriptData::PreCompile() 1011 * \param pre_data Pre-parsing data, as obtained by ScriptData::PreCompile()
1012 * using pre_data speeds compilation if it's done multiple times. 1012 * using pre_data speeds compilation if it's done multiple times.
1013 * Owned by caller, no references are kept when New() returns. 1013 * Owned by caller, no references are kept when New() returns.
1014 * \param script_data Arbitrary data associated with script. Using
1015 * this has same effect as calling SetData(), but allows data to be
1016 * available to compile event handlers.
1014 * \return Compiled script object (context independent; when run it 1017 * \return Compiled script object (context independent; when run it
1015 * will use the currently entered context). 1018 * will use the currently entered context).
1016 */ 1019 */
1017 static Local<Script> New(Handle<String> source, 1020 static Local<Script> New(Handle<String> source,
1018 ScriptOrigin* origin = NULL, 1021 ScriptOrigin* origin = NULL,
1019 ScriptData* pre_data = NULL); 1022 ScriptData* pre_data = NULL,
1023 Handle<String> script_data = Handle<String>());
1020 1024
1021 /** 1025 /**
1022 * Compiles the specified script using the specified file name 1026 * Compiles the specified script using the specified file name
1023 * object (typically a string) as the script's origin. 1027 * object (typically a string) as the script's origin.
1024 * 1028 *
1025 * \param source Script source code. 1029 * \param source Script source code.
1026 * \param file_name file name object (typically a string) to be used 1030 * \param file_name file name object (typically a string) to be used
1027 * as the script's origin. 1031 * as the script's origin.
1028 * \return Compiled script object (context independent; when run it 1032 * \return Compiled script object (context independent; when run it
1029 * will use the currently entered context). 1033 * will use the currently entered context).
1030 */ 1034 */
1031 static Local<Script> New(Handle<String> source, 1035 static Local<Script> New(Handle<String> source,
1032 Handle<Value> file_name); 1036 Handle<Value> file_name);
1033 1037
1034 /** 1038 /**
1035 * Compiles the specified script (bound to current context). 1039 * Compiles the specified script (bound to current context).
1036 * 1040 *
1037 * \param source Script source code. 1041 * \param source Script source code.
1038 * \param origin Script origin, owned by caller, no references are kept 1042 * \param origin Script origin, owned by caller, no references are kept
1039 * when Compile() returns 1043 * when Compile() returns
1040 * \param pre_data Pre-parsing data, as obtained by ScriptData::PreCompile() 1044 * \param pre_data Pre-parsing data, as obtained by ScriptData::PreCompile()
1041 * using pre_data speeds compilation if it's done multiple times. 1045 * using pre_data speeds compilation if it's done multiple times.
1042 * Owned by caller, no references are kept when Compile() returns. 1046 * Owned by caller, no references are kept when Compile() returns.
1047 * \param script_data Arbitrary data associated with script. Using
1048 * this has same effect as calling SetData(), but makes data available
1049 * earlier (i.e. to compile event handlers).
1043 * \return Compiled script object, bound to the context that was active 1050 * \return Compiled script object, bound to the context that was active
1044 * when this function was called. When run it will always use this 1051 * when this function was called. When run it will always use this
1045 * context. 1052 * context.
1046 */ 1053 */
1047 static Local<Script> Compile(Handle<String> source, 1054 static Local<Script> Compile(Handle<String> source,
1048 ScriptOrigin* origin = NULL, 1055 ScriptOrigin* origin = NULL,
1049 ScriptData* pre_data = NULL); 1056 ScriptData* pre_data = NULL,
1057 Handle<String> script_data = Handle<String>());
1050 1058
1051 /** 1059 /**
1052 * Compiles the specified script using the specified file name 1060 * Compiles the specified script using the specified file name
1053 * object (typically a string) as the script's origin. 1061 * object (typically a string) as the script's origin.
1054 * 1062 *
1055 * \param source Script source code. 1063 * \param source Script source code.
1056 * \param file_name File name to use as script's origin 1064 * \param file_name File name to use as script's origin
1065 * \param script_data Arbitrary data associated with script. Using
1066 * this has same effect as calling SetData(), but makes data available
1067 * earlier (i.e. to compile event handlers).
1057 * \return Compiled script object, bound to the context that was active 1068 * \return Compiled script object, bound to the context that was active
1058 * when this function was called. When run it will always use this 1069 * when this function was called. When run it will always use this
1059 * context. 1070 * context.
1060 */ 1071 */
1061 static Local<Script> Compile(Handle<String> source, 1072 static Local<Script> Compile(Handle<String> source,
1062 Handle<Value> file_name); 1073 Handle<Value> file_name,
1074 Handle<String> script_data = Handle<String>());
1063 1075
1064 /** 1076 /**
1065 * Runs the script returning the resulting value. If the script is 1077 * Runs the script returning the resulting value. If the script is
1066 * context independent (created using ::New) it will be run in the 1078 * context independent (created using ::New) it will be run in the
1067 * currently entered context. If it is context specific (created 1079 * currently entered context. If it is context specific (created
1068 * using ::Compile) it will be run in the context in which it was 1080 * using ::Compile) it will be run in the context in which it was
1069 * compiled. 1081 * compiled.
1070 */ 1082 */
1071 Local<Value> Run(); 1083 Local<Value> Run();
1072 1084
1073 /** 1085 /**
1074 * Returns the script id. 1086 * Returns the script id.
1075 */ 1087 */
1076 int GetId(); 1088 int GetId();
1077 1089
1078 /** 1090 /**
1091 * Associate an additional data object with the script. This is mainly used
1092 * with the debugger as this data object is only available through the
1093 * debugger API.
1094 */
1095 void SetData(Handle<String> data);
1096
1097 /**
1079 * Returns the name value of one Script. 1098 * Returns the name value of one Script.
1080 */ 1099 */
1081 Handle<Value> GetScriptName(); 1100 Handle<Value> GetScriptName();
1082 1101
1083 /** 1102 /**
1084 * Returns zero based line number of the code_pos location in the script. 1103 * Returns zero based line number of the code_pos location in the script.
1085 * -1 will be returned if no information available. 1104 * -1 will be returned if no information available.
1086 */ 1105 */
1087 int GetLineNumber(int code_pos); 1106 int GetLineNumber(int code_pos);
1088 1107
(...skipping 5347 matching lines...) Expand 10 before | Expand all | Expand 10 after
6436 */ 6455 */
6437 6456
6438 6457
6439 } // namespace v8 6458 } // namespace v8
6440 6459
6441 6460
6442 #undef TYPE_CHECK 6461 #undef TYPE_CHECK
6443 6462
6444 6463
6445 #endif // V8_H_ 6464 #endif // V8_H_
OLDNEW
« no previous file with comments | « no previous file | src/accessors.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698