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

Side by Side Diff: include/v8.h

Issue 1040043002: ensure maybe results are checked in v8.h (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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
« 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 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 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1111 */ 1111 */
1112 class V8_EXPORT Script { 1112 class V8_EXPORT Script {
1113 public: 1113 public:
1114 /** 1114 /**
1115 * A shorthand for ScriptCompiler::Compile(). 1115 * A shorthand for ScriptCompiler::Compile().
1116 */ 1116 */
1117 static V8_DEPRECATE_SOON( 1117 static V8_DEPRECATE_SOON(
1118 "Use maybe version", 1118 "Use maybe version",
1119 Local<Script> Compile(Handle<String> source, 1119 Local<Script> Compile(Handle<String> source,
1120 ScriptOrigin* origin = nullptr)); 1120 ScriptOrigin* origin = nullptr));
1121 static MaybeLocal<Script> Compile(Local<Context> context, 1121 static V8_WARN_UNUSED_RESULT MaybeLocal<Script> Compile(
1122 Handle<String> source, 1122 Local<Context> context, Handle<String> source,
1123 ScriptOrigin* origin = nullptr); 1123 ScriptOrigin* origin = nullptr);
1124 1124
1125 static Local<Script> V8_DEPRECATE_SOON("Use maybe version", 1125 static Local<Script> V8_DEPRECATE_SOON("Use maybe version",
1126 Compile(Handle<String> source, 1126 Compile(Handle<String> source,
1127 Handle<String> file_name)); 1127 Handle<String> file_name));
1128 1128
1129 /** 1129 /**
1130 * Runs the script returning the resulting value. It will be run in the 1130 * Runs the script returning the resulting value. It will be run in the
1131 * context in which it was created (ScriptCompiler::CompileBound or 1131 * context in which it was created (ScriptCompiler::CompileBound or
1132 * UnboundScript::BindToCurrentContext()). 1132 * UnboundScript::BindToCurrentContext()).
1133 */ 1133 */
1134 V8_DEPRECATE_SOON("Use maybe version", Local<Value> Run()); 1134 V8_DEPRECATE_SOON("Use maybe version", Local<Value> Run());
1135 MaybeLocal<Value> Run(Local<Context> context); 1135 V8_WARN_UNUSED_RESULT MaybeLocal<Value> Run(Local<Context> context);
1136 1136
1137 /** 1137 /**
1138 * Returns the corresponding context-unbound script. 1138 * Returns the corresponding context-unbound script.
1139 */ 1139 */
1140 Local<UnboundScript> GetUnboundScript(); 1140 Local<UnboundScript> GetUnboundScript();
1141 1141
1142 V8_DEPRECATED("Use GetUnboundScript()->GetId()", 1142 V8_DEPRECATED("Use GetUnboundScript()->GetId()",
1143 int GetId()) { 1143 int GetId()) {
1144 return GetUnboundScript()->GetId(); 1144 return GetUnboundScript()->GetId();
1145 } 1145 }
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1317 * produced by the same version of V8. 1317 * produced by the same version of V8.
1318 * 1318 *
1319 * \param source Script source code. 1319 * \param source Script source code.
1320 * \return Compiled script object (context independent; for running it must be 1320 * \return Compiled script object (context independent; for running it must be
1321 * bound to a context). 1321 * bound to a context).
1322 */ 1322 */
1323 static V8_DEPRECATE_SOON("Use maybe version", 1323 static V8_DEPRECATE_SOON("Use maybe version",
1324 Local<UnboundScript> CompileUnbound( 1324 Local<UnboundScript> CompileUnbound(
1325 Isolate* isolate, Source* source, 1325 Isolate* isolate, Source* source,
1326 CompileOptions options = kNoCompileOptions)); 1326 CompileOptions options = kNoCompileOptions));
1327 static MaybeLocal<UnboundScript> CompileUnboundScript( 1327 static V8_WARN_UNUSED_RESULT MaybeLocal<UnboundScript> CompileUnboundScript(
1328 Isolate* isolate, Source* source, 1328 Isolate* isolate, Source* source,
1329 CompileOptions options = kNoCompileOptions); 1329 CompileOptions options = kNoCompileOptions);
1330 1330
1331 /** 1331 /**
1332 * Compiles the specified script (bound to current context). 1332 * Compiles the specified script (bound to current context).
1333 * 1333 *
1334 * \param source Script source code. 1334 * \param source Script source code.
1335 * \param pre_data Pre-parsing data, as obtained by ScriptData::PreCompile() 1335 * \param pre_data Pre-parsing data, as obtained by ScriptData::PreCompile()
1336 * using pre_data speeds compilation if it's done multiple times. 1336 * using pre_data speeds compilation if it's done multiple times.
1337 * Owned by caller, no references are kept when this function returns. 1337 * Owned by caller, no references are kept when this function returns.
1338 * \return Compiled script object, bound to the context that was active 1338 * \return Compiled script object, bound to the context that was active
1339 * when this function was called. When run it will always use this 1339 * when this function was called. When run it will always use this
1340 * context. 1340 * context.
1341 */ 1341 */
1342 static V8_DEPRECATE_SOON( 1342 static V8_DEPRECATE_SOON(
1343 "Use maybe version", 1343 "Use maybe version",
1344 Local<Script> Compile(Isolate* isolate, Source* source, 1344 Local<Script> Compile(Isolate* isolate, Source* source,
1345 CompileOptions options = kNoCompileOptions)); 1345 CompileOptions options = kNoCompileOptions));
1346 static MaybeLocal<Script> Compile(Local<Context> context, Source* source, 1346 static V8_WARN_UNUSED_RESULT MaybeLocal<Script> Compile(
1347 CompileOptions options = kNoCompileOptions); 1347 Local<Context> context, Source* source,
1348 CompileOptions options = kNoCompileOptions);
1348 1349
1349 /** 1350 /**
1350 * Returns a task which streams script data into V8, or NULL if the script 1351 * Returns a task which streams script data into V8, or NULL if the script
1351 * cannot be streamed. The user is responsible for running the task on a 1352 * cannot be streamed. The user is responsible for running the task on a
1352 * background thread and deleting it. When ran, the task starts parsing the 1353 * background thread and deleting it. When ran, the task starts parsing the
1353 * script, and it will request data from the StreamedSource as needed. When 1354 * script, and it will request data from the StreamedSource as needed. When
1354 * ScriptStreamingTask::Run exits, all data has been streamed and the script 1355 * ScriptStreamingTask::Run exits, all data has been streamed and the script
1355 * can be compiled (see Compile below). 1356 * can be compiled (see Compile below).
1356 * 1357 *
1357 * This API allows to start the streaming with as little data as possible, and 1358 * This API allows to start the streaming with as little data as possible, and
1358 * the remaining data (for example, the ScriptOrigin) is passed to Compile. 1359 * the remaining data (for example, the ScriptOrigin) is passed to Compile.
1359 */ 1360 */
1360 static ScriptStreamingTask* StartStreamingScript( 1361 static ScriptStreamingTask* StartStreamingScript(
1361 Isolate* isolate, StreamedSource* source, 1362 Isolate* isolate, StreamedSource* source,
1362 CompileOptions options = kNoCompileOptions); 1363 CompileOptions options = kNoCompileOptions);
1363 1364
1364 /** 1365 /**
1365 * Compiles a streamed script (bound to current context). 1366 * Compiles a streamed script (bound to current context).
1366 * 1367 *
1367 * This can only be called after the streaming has finished 1368 * This can only be called after the streaming has finished
1368 * (ScriptStreamingTask has been run). V8 doesn't construct the source string 1369 * (ScriptStreamingTask has been run). V8 doesn't construct the source string
1369 * during streaming, so the embedder needs to pass the full source here. 1370 * during streaming, so the embedder needs to pass the full source here.
1370 */ 1371 */
1371 static V8_DEPRECATE_SOON( 1372 static V8_DEPRECATE_SOON(
1372 "Use maybe version", 1373 "Use maybe version",
1373 Local<Script> Compile(Isolate* isolate, StreamedSource* source, 1374 Local<Script> Compile(Isolate* isolate, StreamedSource* source,
1374 Handle<String> full_source_string, 1375 Handle<String> full_source_string,
1375 const ScriptOrigin& origin)); 1376 const ScriptOrigin& origin));
1376 static MaybeLocal<Script> Compile(Local<Context> context, 1377 static V8_WARN_UNUSED_RESULT MaybeLocal<Script> Compile(
1377 StreamedSource* source, 1378 Local<Context> context, StreamedSource* source,
1378 Handle<String> full_source_string, 1379 Handle<String> full_source_string, const ScriptOrigin& origin);
1379 const ScriptOrigin& origin);
1380 1380
1381 /** 1381 /**
1382 * Return a version tag for CachedData for the current V8 version & flags. 1382 * Return a version tag for CachedData for the current V8 version & flags.
1383 * 1383 *
1384 * This value is meant only for determining whether a previously generated 1384 * This value is meant only for determining whether a previously generated
1385 * CachedData instance is still valid; the tag has no other meaing. 1385 * CachedData instance is still valid; the tag has no other meaing.
1386 * 1386 *
1387 * Background: The data carried by CachedData may depend on the exact 1387 * Background: The data carried by CachedData may depend on the exact
1388 * V8 version number or currently compiler flags. This means when 1388 * V8 version number or currently compiler flags. This means when
1389 * persisting CachedData, the embedder must take care to not pass in 1389 * persisting CachedData, the embedder must take care to not pass in
(...skipping 13 matching lines...) Expand all
1403 * 1403 *
1404 * This is an experimental feature. 1404 * This is an experimental feature.
1405 * 1405 *
1406 * TODO(adamk): Script is likely the wrong return value for this; 1406 * TODO(adamk): Script is likely the wrong return value for this;
1407 * should return some new Module type. 1407 * should return some new Module type.
1408 */ 1408 */
1409 static V8_DEPRECATE_SOON( 1409 static V8_DEPRECATE_SOON(
1410 "Use maybe version", 1410 "Use maybe version",
1411 Local<Script> CompileModule(Isolate* isolate, Source* source, 1411 Local<Script> CompileModule(Isolate* isolate, Source* source,
1412 CompileOptions options = kNoCompileOptions)); 1412 CompileOptions options = kNoCompileOptions));
1413 static MaybeLocal<Script> CompileModule( 1413 static V8_WARN_UNUSED_RESULT MaybeLocal<Script> CompileModule(
1414 Local<Context> context, Source* source, 1414 Local<Context> context, Source* source,
1415 CompileOptions options = kNoCompileOptions); 1415 CompileOptions options = kNoCompileOptions);
1416 1416
1417 /** 1417 /**
1418 * Compile a function for a given context. This is equivalent to running 1418 * Compile a function for a given context. This is equivalent to running
1419 * 1419 *
1420 * with (obj) { 1420 * with (obj) {
1421 * return function(args) { ... } 1421 * return function(args) { ... }
1422 * } 1422 * }
1423 * 1423 *
1424 * It is possible to specify multiple context extensions (obj in the above 1424 * It is possible to specify multiple context extensions (obj in the above
1425 * example). 1425 * example).
1426 */ 1426 */
1427 static V8_DEPRECATE_SOON("Use maybe version", 1427 static V8_DEPRECATE_SOON("Use maybe version",
1428 Local<Function> CompileFunctionInContext( 1428 Local<Function> CompileFunctionInContext(
1429 Isolate* isolate, Source* source, 1429 Isolate* isolate, Source* source,
1430 Local<Context> context, size_t arguments_count, 1430 Local<Context> context, size_t arguments_count,
1431 Local<String> arguments[], 1431 Local<String> arguments[],
1432 size_t context_extension_count, 1432 size_t context_extension_count,
1433 Local<Object> context_extensions[])); 1433 Local<Object> context_extensions[]));
1434 static MaybeLocal<Function> CompileFunctionInContext( 1434 static V8_WARN_UNUSED_RESULT MaybeLocal<Function> CompileFunctionInContext(
1435 Local<Context> context, Source* source, size_t arguments_count, 1435 Local<Context> context, Source* source, size_t arguments_count,
1436 Local<String> arguments[], size_t context_extension_count, 1436 Local<String> arguments[], size_t context_extension_count,
1437 Local<Object> context_extensions[]); 1437 Local<Object> context_extensions[]);
1438 1438
1439 private: 1439 private:
1440 static MaybeLocal<UnboundScript> CompileUnboundInternal( 1440 static V8_WARN_UNUSED_RESULT MaybeLocal<UnboundScript> CompileUnboundInternal(
1441 Isolate* isolate, Source* source, CompileOptions options, bool is_module); 1441 Isolate* isolate, Source* source, CompileOptions options, bool is_module);
1442 }; 1442 };
1443 1443
1444 1444
1445 /** 1445 /**
1446 * An error message. 1446 * An error message.
1447 */ 1447 */
1448 class V8_EXPORT Message { 1448 class V8_EXPORT Message {
1449 public: 1449 public:
1450 Local<String> Get() const; 1450 Local<String> Get() const;
1451 1451
1452 V8_DEPRECATE_SOON("Use maybe version", Local<String> GetSourceLine()) const; 1452 V8_DEPRECATE_SOON("Use maybe version", Local<String> GetSourceLine()) const;
1453 MaybeLocal<String> GetSourceLine(Local<Context> context) const; 1453 V8_WARN_UNUSED_RESULT MaybeLocal<String> GetSourceLine(
1454 Local<Context> context) const;
1454 1455
1455 /** 1456 /**
1456 * Returns the origin for the script from where the function causing the 1457 * Returns the origin for the script from where the function causing the
1457 * error originates. 1458 * error originates.
1458 */ 1459 */
1459 ScriptOrigin GetScriptOrigin() const; 1460 ScriptOrigin GetScriptOrigin() const;
1460 1461
1461 /** 1462 /**
1462 * Returns the resource name for the script from where the function causing 1463 * Returns the resource name for the script from where the function causing
1463 * the error originates. 1464 * the error originates.
1464 */ 1465 */
1465 Handle<Value> GetScriptResourceName() const; 1466 Handle<Value> GetScriptResourceName() const;
1466 1467
1467 /** 1468 /**
1468 * Exception stack trace. By default stack traces are not captured for 1469 * Exception stack trace. By default stack traces are not captured for
1469 * uncaught exceptions. SetCaptureStackTraceForUncaughtExceptions allows 1470 * uncaught exceptions. SetCaptureStackTraceForUncaughtExceptions allows
1470 * to change this option. 1471 * to change this option.
1471 */ 1472 */
1472 Handle<StackTrace> GetStackTrace() const; 1473 Handle<StackTrace> GetStackTrace() const;
1473 1474
1474 /** 1475 /**
1475 * Returns the number, 1-based, of the line where the error occurred. 1476 * Returns the number, 1-based, of the line where the error occurred.
1476 */ 1477 */
1477 V8_DEPRECATE_SOON("Use maybe version", int GetLineNumber()) const; 1478 V8_DEPRECATE_SOON("Use maybe version", int GetLineNumber()) const;
1478 Maybe<int> GetLineNumber(Local<Context> context) const; 1479 V8_WARN_UNUSED_RESULT Maybe<int> GetLineNumber(Local<Context> context) const;
1479 1480
1480 /** 1481 /**
1481 * Returns the index within the script of the first character where 1482 * Returns the index within the script of the first character where
1482 * the error occurred. 1483 * the error occurred.
1483 */ 1484 */
1484 int GetStartPosition() const; 1485 int GetStartPosition() const;
1485 1486
1486 /** 1487 /**
1487 * Returns the index within the script of the last character where 1488 * Returns the index within the script of the last character where
1488 * the error occurred. 1489 * the error occurred.
1489 */ 1490 */
1490 int GetEndPosition() const; 1491 int GetEndPosition() const;
1491 1492
1492 /** 1493 /**
1493 * Returns the index within the line of the first character where 1494 * Returns the index within the line of the first character where
1494 * the error occurred. 1495 * the error occurred.
1495 */ 1496 */
1496 V8_DEPRECATE_SOON("Use maybe version", int GetStartColumn()) const; 1497 V8_DEPRECATE_SOON("Use maybe version", int GetStartColumn()) const;
1497 Maybe<int> GetStartColumn(Local<Context> context) const; 1498 V8_WARN_UNUSED_RESULT Maybe<int> GetStartColumn(Local<Context> context) const;
1498 1499
1499 /** 1500 /**
1500 * Returns the index within the line of the last character where 1501 * Returns the index within the line of the last character where
1501 * the error occurred. 1502 * the error occurred.
1502 */ 1503 */
1503 V8_DEPRECATE_SOON("Use maybe version", int GetEndColumn()) const; 1504 V8_DEPRECATE_SOON("Use maybe version", int GetEndColumn()) const;
1504 Maybe<int> GetEndColumn(Local<Context> context) const; 1505 V8_WARN_UNUSED_RESULT Maybe<int> GetEndColumn(Local<Context> context) const;
1505 1506
1506 /** 1507 /**
1507 * Passes on the value set by the embedder when it fed the script from which 1508 * Passes on the value set by the embedder when it fed the script from which
1508 * this Message was generated to V8. 1509 * this Message was generated to V8.
1509 */ 1510 */
1510 bool IsSharedCrossOrigin() const; 1511 bool IsSharedCrossOrigin() const;
1511 1512
1512 // TODO(1245381): Print to a string instead of on a FILE. 1513 // TODO(1245381): Print to a string instead of on a FILE.
1513 static void PrintCurrentStackTrace(Isolate* isolate, FILE* out); 1514 static void PrintCurrentStackTrace(Isolate* isolate, FILE* out);
1514 1515
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1663 public: 1664 public:
1664 /** 1665 /**
1665 * Tries to parse the string |json_string| and returns it as value if 1666 * Tries to parse the string |json_string| and returns it as value if
1666 * successful. 1667 * successful.
1667 * 1668 *
1668 * \param json_string The string to parse. 1669 * \param json_string The string to parse.
1669 * \return The corresponding value if successfully parsed. 1670 * \return The corresponding value if successfully parsed.
1670 */ 1671 */
1671 static V8_DEPRECATE_SOON("Use maybe version", 1672 static V8_DEPRECATE_SOON("Use maybe version",
1672 Local<Value> Parse(Local<String> json_string)); 1673 Local<Value> Parse(Local<String> json_string));
1673 static MaybeLocal<Value> Parse(Isolate* isolate, Local<String> json_string); 1674 static V8_WARN_UNUSED_RESULT MaybeLocal<Value> Parse(
1675 Isolate* isolate, Local<String> json_string);
1674 }; 1676 };
1675 1677
1676 1678
1677 /** 1679 /**
1678 * A map whose keys are referenced weakly. It is similar to JavaScript WeakMap 1680 * A map whose keys are referenced weakly. It is similar to JavaScript WeakMap
1679 * but can be created without entering a v8::Context and hence shouldn't 1681 * but can be created without entering a v8::Context and hence shouldn't
1680 * escape to JavaScript. 1682 * escape to JavaScript.
1681 */ 1683 */
1682 class V8_EXPORT NativeWeakMap : public Data { 1684 class V8_EXPORT NativeWeakMap : public Data {
1683 public: 1685 public:
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
1943 * This is an experimental feature. 1945 * This is an experimental feature.
1944 */ 1946 */
1945 bool IsFloat64Array() const; 1947 bool IsFloat64Array() const;
1946 1948
1947 /** 1949 /**
1948 * Returns true if this value is a DataView. 1950 * Returns true if this value is a DataView.
1949 * This is an experimental feature. 1951 * This is an experimental feature.
1950 */ 1952 */
1951 bool IsDataView() const; 1953 bool IsDataView() const;
1952 1954
1953 MaybeLocal<Boolean> ToBoolean(Local<Context> context) const; 1955 V8_WARN_UNUSED_RESULT MaybeLocal<Boolean> ToBoolean(
1954 MaybeLocal<Number> ToNumber(Local<Context> context) const; 1956 Local<Context> context) const;
1955 MaybeLocal<String> ToString(Local<Context> context) const; 1957 V8_WARN_UNUSED_RESULT MaybeLocal<Number> ToNumber(
1956 MaybeLocal<String> ToDetailString(Local<Context> context) const; 1958 Local<Context> context) const;
1957 MaybeLocal<Object> ToObject(Local<Context> context) const; 1959 V8_WARN_UNUSED_RESULT MaybeLocal<String> ToString(
1958 MaybeLocal<Integer> ToInteger(Local<Context> context) const; 1960 Local<Context> context) const;
1959 MaybeLocal<Uint32> ToUint32(Local<Context> context) const; 1961 V8_WARN_UNUSED_RESULT MaybeLocal<String> ToDetailString(
1960 MaybeLocal<Int32> ToInt32(Local<Context> context) const; 1962 Local<Context> context) const;
1963 V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
1964 Local<Context> context) const;
1965 V8_WARN_UNUSED_RESULT MaybeLocal<Integer> ToInteger(
1966 Local<Context> context) const;
1967 V8_WARN_UNUSED_RESULT MaybeLocal<Uint32> ToUint32(
1968 Local<Context> context) const;
1969 V8_WARN_UNUSED_RESULT MaybeLocal<Int32> ToInt32(Local<Context> context) const;
1961 1970
1962 V8_DEPRECATE_SOON("Use maybe version", 1971 V8_DEPRECATE_SOON("Use maybe version",
1963 Local<Boolean> ToBoolean(Isolate* isolate)) const; 1972 Local<Boolean> ToBoolean(Isolate* isolate)) const;
1964 V8_DEPRECATE_SOON("Use maybe version", 1973 V8_DEPRECATE_SOON("Use maybe version",
1965 Local<Number> ToNumber(Isolate* isolate)) const; 1974 Local<Number> ToNumber(Isolate* isolate)) const;
1966 V8_DEPRECATE_SOON("Use maybe version", 1975 V8_DEPRECATE_SOON("Use maybe version",
1967 Local<String> ToString(Isolate* isolate)) const; 1976 Local<String> ToString(Isolate* isolate)) const;
1968 V8_DEPRECATE_SOON("Use maybe version", 1977 V8_DEPRECATE_SOON("Use maybe version",
1969 Local<String> ToDetailString(Isolate* isolate)) const; 1978 Local<String> ToDetailString(Isolate* isolate)) const;
1970 V8_DEPRECATE_SOON("Use maybe version", 1979 V8_DEPRECATE_SOON("Use maybe version",
(...skipping 15 matching lines...) Expand all
1986 inline V8_DEPRECATE_SOON("Use maybe version", 1995 inline V8_DEPRECATE_SOON("Use maybe version",
1987 Local<Integer> ToInteger()) const; 1996 Local<Integer> ToInteger()) const;
1988 inline V8_DEPRECATE_SOON("Use maybe version", Local<Uint32> ToUint32()) const; 1997 inline V8_DEPRECATE_SOON("Use maybe version", Local<Uint32> ToUint32()) const;
1989 inline V8_DEPRECATE_SOON("Use maybe version", Local<Int32> ToInt32()) const; 1998 inline V8_DEPRECATE_SOON("Use maybe version", Local<Int32> ToInt32()) const;
1990 1999
1991 /** 2000 /**
1992 * Attempts to convert a string to an array index. 2001 * Attempts to convert a string to an array index.
1993 * Returns an empty handle if the conversion fails. 2002 * Returns an empty handle if the conversion fails.
1994 */ 2003 */
1995 V8_DEPRECATE_SOON("Use maybe version", Local<Uint32> ToArrayIndex()) const; 2004 V8_DEPRECATE_SOON("Use maybe version", Local<Uint32> ToArrayIndex()) const;
1996 MaybeLocal<Uint32> ToArrayIndex(Local<Context> context) const; 2005 V8_WARN_UNUSED_RESULT MaybeLocal<Uint32> ToArrayIndex(
2006 Local<Context> context) const;
1997 2007
1998 Maybe<bool> BooleanValue(Local<Context> context) const; 2008 V8_WARN_UNUSED_RESULT Maybe<bool> BooleanValue(Local<Context> context) const;
1999 Maybe<double> NumberValue(Local<Context> context) const; 2009 V8_WARN_UNUSED_RESULT Maybe<double> NumberValue(Local<Context> context) const;
2000 Maybe<int64_t> IntegerValue(Local<Context> context) const; 2010 V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
2001 Maybe<uint32_t> Uint32Value(Local<Context> context) const; 2011 Local<Context> context) const;
2002 Maybe<int32_t> Int32Value(Local<Context> context) const; 2012 V8_WARN_UNUSED_RESULT Maybe<uint32_t> Uint32Value(
2013 Local<Context> context) const;
2014 V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;
2003 2015
2004 V8_DEPRECATE_SOON("Use maybe version", bool BooleanValue()) const; 2016 V8_DEPRECATE_SOON("Use maybe version", bool BooleanValue()) const;
2005 V8_DEPRECATE_SOON("Use maybe version", double NumberValue()) const; 2017 V8_DEPRECATE_SOON("Use maybe version", double NumberValue()) const;
2006 V8_DEPRECATE_SOON("Use maybe version", int64_t IntegerValue()) const; 2018 V8_DEPRECATE_SOON("Use maybe version", int64_t IntegerValue()) const;
2007 V8_DEPRECATE_SOON("Use maybe version", uint32_t Uint32Value()) const; 2019 V8_DEPRECATE_SOON("Use maybe version", uint32_t Uint32Value()) const;
2008 V8_DEPRECATE_SOON("Use maybe version", int32_t Int32Value()) const; 2020 V8_DEPRECATE_SOON("Use maybe version", int32_t Int32Value()) const;
2009 2021
2010 /** JS == */ 2022 /** JS == */
2011 V8_DEPRECATE_SOON("Use maybe version", bool Equals(Handle<Value> that)) const; 2023 V8_DEPRECATE_SOON("Use maybe version", bool Equals(Handle<Value> that)) const;
2012 Maybe<bool> Equals(Local<Context> context, Handle<Value> that) const; 2024 V8_WARN_UNUSED_RESULT Maybe<bool> Equals(Local<Context> context,
2025 Handle<Value> that) const;
2013 bool StrictEquals(Handle<Value> that) const; 2026 bool StrictEquals(Handle<Value> that) const;
2014 bool SameValue(Handle<Value> that) const; 2027 bool SameValue(Handle<Value> that) const;
2015 2028
2016 template <class T> V8_INLINE static Value* Cast(T* value); 2029 template <class T> V8_INLINE static Value* Cast(T* value);
2017 2030
2018 private: 2031 private:
2019 V8_INLINE bool QuickIsUndefined() const; 2032 V8_INLINE bool QuickIsUndefined() const;
2020 V8_INLINE bool QuickIsNull() const; 2033 V8_INLINE bool QuickIsNull() const;
2021 V8_INLINE bool QuickIsString() const; 2034 V8_INLINE bool QuickIsString() const;
2022 bool FullIsUndefined() const; 2035 bool FullIsUndefined() const;
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
2279 2292
2280 /** Allocates a new string from UTF-8 data.*/ 2293 /** Allocates a new string from UTF-8 data.*/
2281 static V8_DEPRECATE_SOON( 2294 static V8_DEPRECATE_SOON(
2282 "Use maybe version", 2295 "Use maybe version",
2283 Local<String> NewFromUtf8(Isolate* isolate, const char* data, 2296 Local<String> NewFromUtf8(Isolate* isolate, const char* data,
2284 NewStringType type = kNormalString, 2297 NewStringType type = kNormalString,
2285 int length = -1)); 2298 int length = -1));
2286 2299
2287 /** Allocates a new string from UTF-8 data. Only returns an empty value when 2300 /** Allocates a new string from UTF-8 data. Only returns an empty value when
2288 * length > kMaxLength. **/ 2301 * length > kMaxLength. **/
2289 static MaybeLocal<String> NewFromUtf8(Isolate* isolate, const char* data, 2302 static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewFromUtf8(
2290 v8::NewStringType type, 2303 Isolate* isolate, const char* data, v8::NewStringType type,
2291 int length = -1); 2304 int length = -1);
2292 2305
2293 /** Allocates a new string from Latin-1 data.*/ 2306 /** Allocates a new string from Latin-1 data.*/
2294 static V8_DEPRECATE_SOON( 2307 static V8_DEPRECATE_SOON(
2295 "Use maybe version", 2308 "Use maybe version",
2296 Local<String> NewFromOneByte(Isolate* isolate, const uint8_t* data, 2309 Local<String> NewFromOneByte(Isolate* isolate, const uint8_t* data,
2297 NewStringType type = kNormalString, 2310 NewStringType type = kNormalString,
2298 int length = -1)); 2311 int length = -1));
2299 2312
2300 /** Allocates a new string from Latin-1 data. Only returns an empty value 2313 /** Allocates a new string from Latin-1 data. Only returns an empty value
2301 * when length > kMaxLength. **/ 2314 * when length > kMaxLength. **/
2302 static MaybeLocal<String> NewFromOneByte(Isolate* isolate, 2315 static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewFromOneByte(
2303 const uint8_t* data, 2316 Isolate* isolate, const uint8_t* data, v8::NewStringType type,
2304 v8::NewStringType type, 2317 int length = -1);
2305 int length = -1);
2306 2318
2307 /** Allocates a new string from UTF-16 data.*/ 2319 /** Allocates a new string from UTF-16 data.*/
2308 static V8_DEPRECATE_SOON( 2320 static V8_DEPRECATE_SOON(
2309 "Use maybe version", 2321 "Use maybe version",
2310 Local<String> NewFromTwoByte(Isolate* isolate, const uint16_t* data, 2322 Local<String> NewFromTwoByte(Isolate* isolate, const uint16_t* data,
2311 NewStringType type = kNormalString, 2323 NewStringType type = kNormalString,
2312 int length = -1)); 2324 int length = -1));
2313 2325
2314 /** Allocates a new string from UTF-16 data. Only returns an empty value when 2326 /** Allocates a new string from UTF-16 data. Only returns an empty value when
2315 * length > kMaxLength. **/ 2327 * length > kMaxLength. **/
2316 static MaybeLocal<String> NewFromTwoByte(Isolate* isolate, 2328 static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewFromTwoByte(
2317 const uint16_t* data, 2329 Isolate* isolate, const uint16_t* data, v8::NewStringType type,
2318 v8::NewStringType type, 2330 int length = -1);
2319 int length = -1);
2320 2331
2321 /** 2332 /**
2322 * Creates a new string by concatenating the left and the right strings 2333 * Creates a new string by concatenating the left and the right strings
2323 * passed in as parameters. 2334 * passed in as parameters.
2324 */ 2335 */
2325 static Local<String> Concat(Handle<String> left, Handle<String> right); 2336 static Local<String> Concat(Handle<String> left, Handle<String> right);
2326 2337
2327 /** 2338 /**
2328 * Creates a new external string using the data defined in the given 2339 * Creates a new external string using the data defined in the given
2329 * resource. When the external string is no longer live on V8's heap the 2340 * resource. When the external string is no longer live on V8's heap the
2330 * resource will be disposed by calling its Dispose method. The caller of 2341 * resource will be disposed by calling its Dispose method. The caller of
2331 * this function should not otherwise delete or modify the resource. Neither 2342 * this function should not otherwise delete or modify the resource. Neither
2332 * should the underlying buffer be deallocated or modified except through the 2343 * should the underlying buffer be deallocated or modified except through the
2333 * destructor of the external string resource. 2344 * destructor of the external string resource.
2334 */ 2345 */
2335 static V8_DEPRECATE_SOON( 2346 static V8_DEPRECATE_SOON(
2336 "Use maybe version", 2347 "Use maybe version",
2337 Local<String> NewExternal(Isolate* isolate, 2348 Local<String> NewExternal(Isolate* isolate,
2338 ExternalStringResource* resource)); 2349 ExternalStringResource* resource));
2339 static MaybeLocal<String> NewExternalTwoByte( 2350 static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewExternalTwoByte(
2340 Isolate* isolate, ExternalStringResource* resource); 2351 Isolate* isolate, ExternalStringResource* resource);
2341 2352
2342 /** 2353 /**
2343 * Associate an external string resource with this string by transforming it 2354 * Associate an external string resource with this string by transforming it
2344 * in place so that existing references to this string in the JavaScript heap 2355 * in place so that existing references to this string in the JavaScript heap
2345 * will use the external string resource. The external string resource's 2356 * will use the external string resource. The external string resource's
2346 * character contents need to be equivalent to this string. 2357 * character contents need to be equivalent to this string.
2347 * Returns true if the string has been changed to be an external string. 2358 * Returns true if the string has been changed to be an external string.
2348 * The string is not modified if the operation fails. See NewExternal for 2359 * The string is not modified if the operation fails. See NewExternal for
2349 * information on the lifetime of the resource. 2360 * information on the lifetime of the resource.
2350 */ 2361 */
2351 bool MakeExternal(ExternalStringResource* resource); 2362 bool MakeExternal(ExternalStringResource* resource);
2352 2363
2353 /** 2364 /**
2354 * Creates a new external string using the one-byte data defined in the given 2365 * Creates a new external string using the one-byte data defined in the given
2355 * resource. When the external string is no longer live on V8's heap the 2366 * resource. When the external string is no longer live on V8's heap the
2356 * resource will be disposed by calling its Dispose method. The caller of 2367 * resource will be disposed by calling its Dispose method. The caller of
2357 * this function should not otherwise delete or modify the resource. Neither 2368 * this function should not otherwise delete or modify the resource. Neither
2358 * should the underlying buffer be deallocated or modified except through the 2369 * should the underlying buffer be deallocated or modified except through the
2359 * destructor of the external string resource. 2370 * destructor of the external string resource.
2360 */ 2371 */
2361 static V8_DEPRECATE_SOON( 2372 static V8_DEPRECATE_SOON(
2362 "Use maybe version", 2373 "Use maybe version",
2363 Local<String> NewExternal(Isolate* isolate, 2374 Local<String> NewExternal(Isolate* isolate,
2364 ExternalOneByteStringResource* resource)); 2375 ExternalOneByteStringResource* resource));
2365 static MaybeLocal<String> NewExternalOneByte( 2376 static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewExternalOneByte(
2366 Isolate* isolate, ExternalOneByteStringResource* resource); 2377 Isolate* isolate, ExternalOneByteStringResource* resource);
2367 2378
2368 /** 2379 /**
2369 * Associate an external string resource with this string by transforming it 2380 * Associate an external string resource with this string by transforming it
2370 * in place so that existing references to this string in the JavaScript heap 2381 * in place so that existing references to this string in the JavaScript heap
2371 * will use the external string resource. The external string resource's 2382 * will use the external string resource. The external string resource's
2372 * character contents need to be equivalent to this string. 2383 * character contents need to be equivalent to this string.
2373 * Returns true if the string has been changed to be an external string. 2384 * Returns true if the string has been changed to be an external string.
2374 * The string is not modified if the operation fails. See NewExternal for 2385 * The string is not modified if the operation fails. See NewExternal for
2375 * information on the lifetime of the resource. 2386 * information on the lifetime of the resource.
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
2627 }; 2638 };
2628 2639
2629 2640
2630 /** 2641 /**
2631 * A JavaScript object (ECMA-262, 4.3.3) 2642 * A JavaScript object (ECMA-262, 4.3.3)
2632 */ 2643 */
2633 class V8_EXPORT Object : public Value { 2644 class V8_EXPORT Object : public Value {
2634 public: 2645 public:
2635 V8_DEPRECATE_SOON("Use maybe version", 2646 V8_DEPRECATE_SOON("Use maybe version",
2636 bool Set(Handle<Value> key, Handle<Value> value)); 2647 bool Set(Handle<Value> key, Handle<Value> value));
2637 Maybe<bool> Set(Local<Context> context, Local<Value> key, Local<Value> value); 2648 V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
2649 Local<Value> key, Local<Value> value);
2638 2650
2639 V8_DEPRECATE_SOON("Use maybe version", 2651 V8_DEPRECATE_SOON("Use maybe version",
2640 bool Set(uint32_t index, Handle<Value> value)); 2652 bool Set(uint32_t index, Handle<Value> value));
2641 Maybe<bool> Set(Local<Context> context, uint32_t index, Local<Value> value); 2653 V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
2654 Local<Value> value);
2642 2655
2643 // Sets an own property on this object bypassing interceptors and 2656 // Sets an own property on this object bypassing interceptors and
2644 // overriding accessors or read-only properties. 2657 // overriding accessors or read-only properties.
2645 // 2658 //
2646 // Note that if the object has an interceptor the property will be set 2659 // Note that if the object has an interceptor the property will be set
2647 // locally, but since the interceptor takes precedence the local property 2660 // locally, but since the interceptor takes precedence the local property
2648 // will only be returned if the interceptor doesn't return a value. 2661 // will only be returned if the interceptor doesn't return a value.
2649 // 2662 //
2650 // Note also that this only works for named properties. 2663 // Note also that this only works for named properties.
2651 V8_DEPRECATE_SOON("Use maybe version", 2664 V8_DEPRECATE_SOON("Use maybe version",
2652 bool ForceSet(Handle<Value> key, Handle<Value> value, 2665 bool ForceSet(Handle<Value> key, Handle<Value> value,
2653 PropertyAttribute attribs = None)); 2666 PropertyAttribute attribs = None));
2667 // TODO(dcarney): mark V8_WARN_UNUSED_RESULT
2654 Maybe<bool> ForceSet(Local<Context> context, Local<Value> key, 2668 Maybe<bool> ForceSet(Local<Context> context, Local<Value> key,
2655 Local<Value> value, PropertyAttribute attribs = None); 2669 Local<Value> value, PropertyAttribute attribs = None);
2656 2670
2657 V8_DEPRECATE_SOON("Use maybe version", Local<Value> Get(Handle<Value> key)); 2671 V8_DEPRECATE_SOON("Use maybe version", Local<Value> Get(Handle<Value> key));
2658 MaybeLocal<Value> Get(Local<Context> context, Local<Value> key); 2672 V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
2673 Local<Value> key);
2659 2674
2660 V8_DEPRECATE_SOON("Use maybe version", Local<Value> Get(uint32_t index)); 2675 V8_DEPRECATE_SOON("Use maybe version", Local<Value> Get(uint32_t index));
2661 MaybeLocal<Value> Get(Local<Context> context, uint32_t index); 2676 V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
2677 uint32_t index);
2662 2678
2663 /** 2679 /**
2664 * Gets the property attributes of a property which can be None or 2680 * Gets the property attributes of a property which can be None or
2665 * any combination of ReadOnly, DontEnum and DontDelete. Returns 2681 * any combination of ReadOnly, DontEnum and DontDelete. Returns
2666 * None when the property doesn't exist. 2682 * None when the property doesn't exist.
2667 */ 2683 */
2668 V8_DEPRECATE_SOON("Use maybe version", 2684 V8_DEPRECATE_SOON("Use maybe version",
2669 PropertyAttribute GetPropertyAttributes(Handle<Value> key)); 2685 PropertyAttribute GetPropertyAttributes(Handle<Value> key));
2670 Maybe<PropertyAttribute> GetPropertyAttributes(Local<Context> context, 2686 V8_WARN_UNUSED_RESULT Maybe<PropertyAttribute> GetPropertyAttributes(
2671 Local<Value> key); 2687 Local<Context> context, Local<Value> key);
2672 2688
2673 /** 2689 /**
2674 * Returns Object.getOwnPropertyDescriptor as per ES5 section 15.2.3.3. 2690 * Returns Object.getOwnPropertyDescriptor as per ES5 section 15.2.3.3.
2675 */ 2691 */
2676 V8_DEPRECATE_SOON("Use maybe version", 2692 V8_DEPRECATE_SOON("Use maybe version",
2677 Local<Value> GetOwnPropertyDescriptor(Local<String> key)); 2693 Local<Value> GetOwnPropertyDescriptor(Local<String> key));
2678 MaybeLocal<Value> GetOwnPropertyDescriptor(Local<Context> context, 2694 V8_WARN_UNUSED_RESULT MaybeLocal<Value> GetOwnPropertyDescriptor(
2679 Local<String> key); 2695 Local<Context> context, Local<String> key);
2680 2696
2681 V8_DEPRECATE_SOON("Use maybe version", bool Has(Handle<Value> key)); 2697 V8_DEPRECATE_SOON("Use maybe version", bool Has(Handle<Value> key));
2682 Maybe<bool> Has(Local<Context> context, Local<Value> key); 2698 V8_WARN_UNUSED_RESULT Maybe<bool> Has(Local<Context> context,
2699 Local<Value> key);
2683 2700
2684 V8_DEPRECATE_SOON("Use maybe version", bool Delete(Handle<Value> key)); 2701 V8_DEPRECATE_SOON("Use maybe version", bool Delete(Handle<Value> key));
2702 // TODO(dcarney): mark V8_WARN_UNUSED_RESULT
2685 Maybe<bool> Delete(Local<Context> context, Local<Value> key); 2703 Maybe<bool> Delete(Local<Context> context, Local<Value> key);
2686 2704
2687 V8_DEPRECATE_SOON("Use maybe version", bool Has(uint32_t index)); 2705 V8_DEPRECATE_SOON("Use maybe version", bool Has(uint32_t index));
2688 Maybe<bool> Has(Local<Context> context, uint32_t index); 2706 V8_WARN_UNUSED_RESULT Maybe<bool> Has(Local<Context> context, uint32_t index);
2689 2707
2690 V8_DEPRECATE_SOON("Use maybe version", bool Delete(uint32_t index)); 2708 V8_DEPRECATE_SOON("Use maybe version", bool Delete(uint32_t index));
2709 // TODO(dcarney): mark V8_WARN_UNUSED_RESULT
2691 Maybe<bool> Delete(Local<Context> context, uint32_t index); 2710 Maybe<bool> Delete(Local<Context> context, uint32_t index);
2692 2711
2693 V8_DEPRECATE_SOON("Use maybe version", 2712 V8_DEPRECATE_SOON("Use maybe version",
2694 bool SetAccessor(Handle<String> name, 2713 bool SetAccessor(Handle<String> name,
2695 AccessorGetterCallback getter, 2714 AccessorGetterCallback getter,
2696 AccessorSetterCallback setter = 0, 2715 AccessorSetterCallback setter = 0,
2697 Handle<Value> data = Handle<Value>(), 2716 Handle<Value> data = Handle<Value>(),
2698 AccessControl settings = DEFAULT, 2717 AccessControl settings = DEFAULT,
2699 PropertyAttribute attribute = None)); 2718 PropertyAttribute attribute = None));
2700 V8_DEPRECATE_SOON("Use maybe version", 2719 V8_DEPRECATE_SOON("Use maybe version",
2701 bool SetAccessor(Handle<Name> name, 2720 bool SetAccessor(Handle<Name> name,
2702 AccessorNameGetterCallback getter, 2721 AccessorNameGetterCallback getter,
2703 AccessorNameSetterCallback setter = 0, 2722 AccessorNameSetterCallback setter = 0,
2704 Handle<Value> data = Handle<Value>(), 2723 Handle<Value> data = Handle<Value>(),
2705 AccessControl settings = DEFAULT, 2724 AccessControl settings = DEFAULT,
2706 PropertyAttribute attribute = None)); 2725 PropertyAttribute attribute = None));
2726 // TODO(dcarney): mark V8_WARN_UNUSED_RESULT
2707 Maybe<bool> SetAccessor(Local<Context> context, Local<Name> name, 2727 Maybe<bool> SetAccessor(Local<Context> context, Local<Name> name,
2708 AccessorNameGetterCallback getter, 2728 AccessorNameGetterCallback getter,
2709 AccessorNameSetterCallback setter = 0, 2729 AccessorNameSetterCallback setter = 0,
2710 MaybeLocal<Value> data = MaybeLocal<Value>(), 2730 MaybeLocal<Value> data = MaybeLocal<Value>(),
2711 AccessControl settings = DEFAULT, 2731 AccessControl settings = DEFAULT,
2712 PropertyAttribute attribute = None); 2732 PropertyAttribute attribute = None);
2713 2733
2714 void SetAccessorProperty(Local<Name> name, 2734 void SetAccessorProperty(Local<Name> name,
2715 Local<Function> getter, 2735 Local<Function> getter,
2716 Handle<Function> setter = Handle<Function>(), 2736 Handle<Function> setter = Handle<Function>(),
(...skipping 12 matching lines...) Expand all
2729 bool DeletePrivate(Handle<Private> key); 2749 bool DeletePrivate(Handle<Private> key);
2730 Local<Value> GetPrivate(Handle<Private> key); 2750 Local<Value> GetPrivate(Handle<Private> key);
2731 2751
2732 /** 2752 /**
2733 * Returns an array containing the names of the enumerable properties 2753 * Returns an array containing the names of the enumerable properties
2734 * of this object, including properties from prototype objects. The 2754 * of this object, including properties from prototype objects. The
2735 * array returned by this method contains the same values as would 2755 * array returned by this method contains the same values as would
2736 * be enumerated by a for-in statement over this object. 2756 * be enumerated by a for-in statement over this object.
2737 */ 2757 */
2738 V8_DEPRECATE_SOON("Use maybe version", Local<Array> GetPropertyNames()); 2758 V8_DEPRECATE_SOON("Use maybe version", Local<Array> GetPropertyNames());
2739 MaybeLocal<Array> GetPropertyNames(Local<Context> context); 2759 V8_WARN_UNUSED_RESULT MaybeLocal<Array> GetPropertyNames(
2760 Local<Context> context);
2740 2761
2741 /** 2762 /**
2742 * This function has the same functionality as GetPropertyNames but 2763 * This function has the same functionality as GetPropertyNames but
2743 * the returned array doesn't contain the names of properties from 2764 * the returned array doesn't contain the names of properties from
2744 * prototype objects. 2765 * prototype objects.
2745 */ 2766 */
2746 V8_DEPRECATE_SOON("Use maybe version", Local<Array> GetOwnPropertyNames()); 2767 V8_DEPRECATE_SOON("Use maybe version", Local<Array> GetOwnPropertyNames());
2747 MaybeLocal<Array> GetOwnPropertyNames(Local<Context> context); 2768 V8_WARN_UNUSED_RESULT MaybeLocal<Array> GetOwnPropertyNames(
2769 Local<Context> context);
2748 2770
2749 /** 2771 /**
2750 * Get the prototype object. This does not skip objects marked to 2772 * Get the prototype object. This does not skip objects marked to
2751 * be skipped by __proto__ and it does not consult the security 2773 * be skipped by __proto__ and it does not consult the security
2752 * handler. 2774 * handler.
2753 */ 2775 */
2754 Local<Value> GetPrototype(); 2776 Local<Value> GetPrototype();
2755 2777
2756 /** 2778 /**
2757 * Set the prototype object. This does not skip objects marked to 2779 * Set the prototype object. This does not skip objects marked to
2758 * be skipped by __proto__ and it does not consult the security 2780 * be skipped by __proto__ and it does not consult the security
2759 * handler. 2781 * handler.
2760 */ 2782 */
2761 V8_DEPRECATE_SOON("Use maybe version", 2783 V8_DEPRECATE_SOON("Use maybe version",
2762 bool SetPrototype(Handle<Value> prototype)); 2784 bool SetPrototype(Handle<Value> prototype));
2763 Maybe<bool> SetPrototype(Local<Context> context, Local<Value> prototype); 2785 V8_WARN_UNUSED_RESULT Maybe<bool> SetPrototype(Local<Context> context,
2786 Local<Value> prototype);
2764 2787
2765 /** 2788 /**
2766 * Finds an instance of the given function template in the prototype 2789 * Finds an instance of the given function template in the prototype
2767 * chain. 2790 * chain.
2768 */ 2791 */
2769 Local<Object> FindInstanceInPrototypeChain(Handle<FunctionTemplate> tmpl); 2792 Local<Object> FindInstanceInPrototypeChain(Handle<FunctionTemplate> tmpl);
2770 2793
2771 /** 2794 /**
2772 * Call builtin Object.prototype.toString on this object. 2795 * Call builtin Object.prototype.toString on this object.
2773 * This is different from Value::ToString() that may call 2796 * This is different from Value::ToString() that may call
2774 * user-defined toString function. This one does not. 2797 * user-defined toString function. This one does not.
2775 */ 2798 */
2776 V8_DEPRECATE_SOON("Use maybe version", Local<String> ObjectProtoToString()); 2799 V8_DEPRECATE_SOON("Use maybe version", Local<String> ObjectProtoToString());
2777 MaybeLocal<String> ObjectProtoToString(Local<Context> context); 2800 V8_WARN_UNUSED_RESULT MaybeLocal<String> ObjectProtoToString(
2801 Local<Context> context);
2778 2802
2779 /** 2803 /**
2780 * Returns the name of the function invoked as a constructor for this object. 2804 * Returns the name of the function invoked as a constructor for this object.
2781 */ 2805 */
2782 Local<String> GetConstructorName(); 2806 Local<String> GetConstructorName();
2783 2807
2784 /** Gets the number of internal fields for this Object. */ 2808 /** Gets the number of internal fields for this Object. */
2785 int InternalFieldCount(); 2809 int InternalFieldCount();
2786 2810
2787 /** Same as above, but works for Persistents */ 2811 /** Same as above, but works for Persistents */
(...skipping 24 matching lines...) Expand all
2812 /** 2836 /**
2813 * Sets a 2-byte-aligned native pointer in an internal field. To retrieve such 2837 * Sets a 2-byte-aligned native pointer in an internal field. To retrieve such
2814 * a field, GetAlignedPointerFromInternalField must be used, everything else 2838 * a field, GetAlignedPointerFromInternalField must be used, everything else
2815 * leads to undefined behavior. 2839 * leads to undefined behavior.
2816 */ 2840 */
2817 void SetAlignedPointerInInternalField(int index, void* value); 2841 void SetAlignedPointerInInternalField(int index, void* value);
2818 2842
2819 // Testers for local properties. 2843 // Testers for local properties.
2820 V8_DEPRECATE_SOON("Use maybe version", 2844 V8_DEPRECATE_SOON("Use maybe version",
2821 bool HasOwnProperty(Handle<String> key)); 2845 bool HasOwnProperty(Handle<String> key));
2822 Maybe<bool> HasOwnProperty(Local<Context> context, Local<Name> key); 2846 V8_WARN_UNUSED_RESULT Maybe<bool> HasOwnProperty(Local<Context> context,
2847 Local<Name> key);
2823 V8_DEPRECATE_SOON("Use maybe version", 2848 V8_DEPRECATE_SOON("Use maybe version",
2824 bool HasRealNamedProperty(Handle<String> key)); 2849 bool HasRealNamedProperty(Handle<String> key));
2825 Maybe<bool> HasRealNamedProperty(Local<Context> context, Local<Name> key); 2850 V8_WARN_UNUSED_RESULT Maybe<bool> HasRealNamedProperty(Local<Context> context,
2851 Local<Name> key);
2826 V8_DEPRECATE_SOON("Use maybe version", 2852 V8_DEPRECATE_SOON("Use maybe version",
2827 bool HasRealIndexedProperty(uint32_t index)); 2853 bool HasRealIndexedProperty(uint32_t index));
2828 Maybe<bool> HasRealIndexedProperty(Local<Context> context, uint32_t index); 2854 V8_WARN_UNUSED_RESULT Maybe<bool> HasRealIndexedProperty(
2855 Local<Context> context, uint32_t index);
2829 V8_DEPRECATE_SOON("Use maybe version", 2856 V8_DEPRECATE_SOON("Use maybe version",
2830 bool HasRealNamedCallbackProperty(Handle<String> key)); 2857 bool HasRealNamedCallbackProperty(Handle<String> key));
2831 Maybe<bool> HasRealNamedCallbackProperty(Local<Context> context, 2858 V8_WARN_UNUSED_RESULT Maybe<bool> HasRealNamedCallbackProperty(
2832 Local<Name> key); 2859 Local<Context> context, Local<Name> key);
2833 2860
2834 /** 2861 /**
2835 * If result.IsEmpty() no real property was located in the prototype chain. 2862 * If result.IsEmpty() no real property was located in the prototype chain.
2836 * This means interceptors in the prototype chain are not called. 2863 * This means interceptors in the prototype chain are not called.
2837 */ 2864 */
2838 V8_DEPRECATE_SOON( 2865 V8_DEPRECATE_SOON(
2839 "Use maybe version", 2866 "Use maybe version",
2840 Local<Value> GetRealNamedPropertyInPrototypeChain(Handle<String> key)); 2867 Local<Value> GetRealNamedPropertyInPrototypeChain(Handle<String> key));
2841 MaybeLocal<Value> GetRealNamedPropertyInPrototypeChain(Local<Context> context, 2868 V8_WARN_UNUSED_RESULT MaybeLocal<Value> GetRealNamedPropertyInPrototypeChain(
2842 Local<Name> key); 2869 Local<Context> context, Local<Name> key);
2843 2870
2844 /** 2871 /**
2845 * Gets the property attributes of a real property in the prototype chain, 2872 * Gets the property attributes of a real property in the prototype chain,
2846 * which can be None or any combination of ReadOnly, DontEnum and DontDelete. 2873 * which can be None or any combination of ReadOnly, DontEnum and DontDelete.
2847 * Interceptors in the prototype chain are not called. 2874 * Interceptors in the prototype chain are not called.
2848 */ 2875 */
2849 V8_DEPRECATE_SOON( 2876 V8_DEPRECATE_SOON(
2850 "Use maybe version", 2877 "Use maybe version",
2851 Maybe<PropertyAttribute> GetRealNamedPropertyAttributesInPrototypeChain( 2878 Maybe<PropertyAttribute> GetRealNamedPropertyAttributesInPrototypeChain(
2852 Handle<String> key)); 2879 Handle<String> key));
2853 Maybe<PropertyAttribute> GetRealNamedPropertyAttributesInPrototypeChain( 2880 V8_WARN_UNUSED_RESULT Maybe<PropertyAttribute>
2854 Local<Context> context, Local<Name> key); 2881 GetRealNamedPropertyAttributesInPrototypeChain(Local<Context> context,
2882 Local<Name> key);
2855 2883
2856 /** 2884 /**
2857 * If result.IsEmpty() no real property was located on the object or 2885 * If result.IsEmpty() no real property was located on the object or
2858 * in the prototype chain. 2886 * in the prototype chain.
2859 * This means interceptors in the prototype chain are not called. 2887 * This means interceptors in the prototype chain are not called.
2860 */ 2888 */
2861 V8_DEPRECATE_SOON("Use maybe version", 2889 V8_DEPRECATE_SOON("Use maybe version",
2862 Local<Value> GetRealNamedProperty(Handle<String> key)); 2890 Local<Value> GetRealNamedProperty(Handle<String> key));
2863 MaybeLocal<Value> GetRealNamedProperty(Local<Context> context, 2891 V8_WARN_UNUSED_RESULT MaybeLocal<Value> GetRealNamedProperty(
2864 Local<Name> key); 2892 Local<Context> context, Local<Name> key);
2865 2893
2866 /** 2894 /**
2867 * Gets the property attributes of a real property which can be 2895 * Gets the property attributes of a real property which can be
2868 * None or any combination of ReadOnly, DontEnum and DontDelete. 2896 * None or any combination of ReadOnly, DontEnum and DontDelete.
2869 * Interceptors in the prototype chain are not called. 2897 * Interceptors in the prototype chain are not called.
2870 */ 2898 */
2871 V8_DEPRECATE_SOON("Use maybe version", 2899 V8_DEPRECATE_SOON("Use maybe version",
2872 Maybe<PropertyAttribute> GetRealNamedPropertyAttributes( 2900 Maybe<PropertyAttribute> GetRealNamedPropertyAttributes(
2873 Handle<String> key)); 2901 Handle<String> key));
2874 Maybe<PropertyAttribute> GetRealNamedPropertyAttributes( 2902 V8_WARN_UNUSED_RESULT Maybe<PropertyAttribute> GetRealNamedPropertyAttributes(
2875 Local<Context> context, Local<Name> key); 2903 Local<Context> context, Local<Name> key);
2876 2904
2877 /** Tests for a named lookup interceptor.*/ 2905 /** Tests for a named lookup interceptor.*/
2878 bool HasNamedLookupInterceptor(); 2906 bool HasNamedLookupInterceptor();
2879 2907
2880 /** Tests for an index lookup interceptor.*/ 2908 /** Tests for an index lookup interceptor.*/
2881 bool HasIndexedLookupInterceptor(); 2909 bool HasIndexedLookupInterceptor();
2882 2910
2883 /** 2911 /**
2884 * Turns on access check on the object if the object is an instance of 2912 * Turns on access check on the object if the object is an instance of
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
2953 */ 2981 */
2954 bool IsCallable(); 2982 bool IsCallable();
2955 2983
2956 /** 2984 /**
2957 * Call an Object as a function if a callback is set by the 2985 * Call an Object as a function if a callback is set by the
2958 * ObjectTemplate::SetCallAsFunctionHandler method. 2986 * ObjectTemplate::SetCallAsFunctionHandler method.
2959 */ 2987 */
2960 V8_DEPRECATE_SOON("Use maybe version", 2988 V8_DEPRECATE_SOON("Use maybe version",
2961 Local<Value> CallAsFunction(Handle<Value> recv, int argc, 2989 Local<Value> CallAsFunction(Handle<Value> recv, int argc,
2962 Handle<Value> argv[])); 2990 Handle<Value> argv[]));
2963 MaybeLocal<Value> CallAsFunction(Local<Context> context, Handle<Value> recv, 2991 V8_WARN_UNUSED_RESULT MaybeLocal<Value> CallAsFunction(Local<Context> context,
2964 int argc, Handle<Value> argv[]); 2992 Handle<Value> recv,
2993 int argc,
2994 Handle<Value> argv[]);
2965 2995
2966 /** 2996 /**
2967 * Call an Object as a constructor if a callback is set by the 2997 * Call an Object as a constructor if a callback is set by the
2968 * ObjectTemplate::SetCallAsFunctionHandler method. 2998 * ObjectTemplate::SetCallAsFunctionHandler method.
2969 * Note: This method behaves like the Function::NewInstance method. 2999 * Note: This method behaves like the Function::NewInstance method.
2970 */ 3000 */
2971 V8_DEPRECATE_SOON("Use maybe version", 3001 V8_DEPRECATE_SOON("Use maybe version",
2972 Local<Value> CallAsConstructor(int argc, 3002 Local<Value> CallAsConstructor(int argc,
2973 Handle<Value> argv[])); 3003 Handle<Value> argv[]));
2974 MaybeLocal<Value> CallAsConstructor(Local<Context> context, int argc, 3004 V8_WARN_UNUSED_RESULT MaybeLocal<Value> CallAsConstructor(
2975 Local<Value> argv[]); 3005 Local<Context> context, int argc, Local<Value> argv[]);
2976 3006
2977 /** 3007 /**
2978 * Return the isolate to which the Object belongs to. 3008 * Return the isolate to which the Object belongs to.
2979 */ 3009 */
2980 V8_DEPRECATE_SOON("Keep track of isolate correctly", Isolate* GetIsolate()); 3010 V8_DEPRECATE_SOON("Keep track of isolate correctly", Isolate* GetIsolate());
2981 3011
2982 static Local<Object> New(Isolate* isolate); 3012 static Local<Object> New(Isolate* isolate);
2983 3013
2984 V8_INLINE static Object* Cast(Value* obj); 3014 V8_INLINE static Object* Cast(Value* obj);
2985 3015
(...skipping 11 matching lines...) Expand all
2997 class V8_EXPORT Array : public Object { 3027 class V8_EXPORT Array : public Object {
2998 public: 3028 public:
2999 uint32_t Length() const; 3029 uint32_t Length() const;
3000 3030
3001 /** 3031 /**
3002 * Clones an element at index |index|. Returns an empty 3032 * Clones an element at index |index|. Returns an empty
3003 * handle if cloning fails (for any reason). 3033 * handle if cloning fails (for any reason).
3004 */ 3034 */
3005 V8_DEPRECATE_SOON("Use maybe version", 3035 V8_DEPRECATE_SOON("Use maybe version",
3006 Local<Object> CloneElementAt(uint32_t index)); 3036 Local<Object> CloneElementAt(uint32_t index));
3007 MaybeLocal<Object> CloneElementAt(Local<Context> context, uint32_t index); 3037 V8_WARN_UNUSED_RESULT MaybeLocal<Object> CloneElementAt(
3038 Local<Context> context, uint32_t index);
3008 3039
3009 /** 3040 /**
3010 * Creates a JavaScript array with the given length. If the length 3041 * Creates a JavaScript array with the given length. If the length
3011 * is negative the returned array will have length 0. 3042 * is negative the returned array will have length 0.
3012 */ 3043 */
3013 static Local<Array> New(Isolate* isolate, int length = 0); 3044 static Local<Array> New(Isolate* isolate, int length = 0);
3014 3045
3015 V8_INLINE static Array* Cast(Value* obj); 3046 V8_INLINE static Array* Cast(Value* obj);
3016 private: 3047 private:
3017 Array(); 3048 Array();
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
3145 * for a given FunctionCallback. 3176 * for a given FunctionCallback.
3146 */ 3177 */
3147 static Local<Function> New(Isolate* isolate, 3178 static Local<Function> New(Isolate* isolate,
3148 FunctionCallback callback, 3179 FunctionCallback callback,
3149 Local<Value> data = Local<Value>(), 3180 Local<Value> data = Local<Value>(),
3150 int length = 0); 3181 int length = 0);
3151 3182
3152 V8_DEPRECATE_SOON("Use maybe version", 3183 V8_DEPRECATE_SOON("Use maybe version",
3153 Local<Object> NewInstance(int argc, 3184 Local<Object> NewInstance(int argc,
3154 Handle<Value> argv[])) const; 3185 Handle<Value> argv[])) const;
3155 MaybeLocal<Object> NewInstance(Local<Context> context, int argc, 3186 V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(
3156 Handle<Value> argv[]) const; 3187 Local<Context> context, int argc, Handle<Value> argv[]) const;
3157 3188
3158 V8_DEPRECATE_SOON("Use maybe version", Local<Object> NewInstance()) const; 3189 V8_DEPRECATE_SOON("Use maybe version", Local<Object> NewInstance()) const;
3159 MaybeLocal<Object> NewInstance(Local<Context> context) const { 3190 V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(
3191 Local<Context> context) const {
3160 return NewInstance(context, 0, nullptr); 3192 return NewInstance(context, 0, nullptr);
3161 } 3193 }
3162 3194
3163 V8_DEPRECATE_SOON("Use maybe version", 3195 V8_DEPRECATE_SOON("Use maybe version",
3164 Local<Value> Call(Handle<Value> recv, int argc, 3196 Local<Value> Call(Handle<Value> recv, int argc,
3165 Handle<Value> argv[])); 3197 Handle<Value> argv[]));
3166 MaybeLocal<Value> Call(Local<Context> context, Handle<Value> recv, int argc, 3198 V8_WARN_UNUSED_RESULT MaybeLocal<Value> Call(Local<Context> context,
3167 Handle<Value> argv[]); 3199 Handle<Value> recv, int argc,
3200 Handle<Value> argv[]);
3168 3201
3169 void SetName(Handle<String> name); 3202 void SetName(Handle<String> name);
3170 Handle<Value> GetName() const; 3203 Handle<Value> GetName() const;
3171 3204
3172 /** 3205 /**
3173 * Name inferred from variable or property assignment of this function. 3206 * Name inferred from variable or property assignment of this function.
3174 * Used to facilitate debugging and profiling of JavaScript code written 3207 * Used to facilitate debugging and profiling of JavaScript code written
3175 * in an OO style, where many functions are anonymous but are assigned 3208 * in an OO style, where many functions are anonymous but are assigned
3176 * to object properties. 3209 * to object properties.
3177 */ 3210 */
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
3226 */ 3259 */
3227 class V8_EXPORT Promise : public Object { 3260 class V8_EXPORT Promise : public Object {
3228 public: 3261 public:
3229 class V8_EXPORT Resolver : public Object { 3262 class V8_EXPORT Resolver : public Object {
3230 public: 3263 public:
3231 /** 3264 /**
3232 * Create a new resolver, along with an associated promise in pending state. 3265 * Create a new resolver, along with an associated promise in pending state.
3233 */ 3266 */
3234 static V8_DEPRECATE_SOON("Use maybe version", 3267 static V8_DEPRECATE_SOON("Use maybe version",
3235 Local<Resolver> New(Isolate* isolate)); 3268 Local<Resolver> New(Isolate* isolate));
3236 static MaybeLocal<Resolver> New(Local<Context> context); 3269 static V8_WARN_UNUSED_RESULT MaybeLocal<Resolver> New(
3270 Local<Context> context);
3237 3271
3238 /** 3272 /**
3239 * Extract the associated promise. 3273 * Extract the associated promise.
3240 */ 3274 */
3241 Local<Promise> GetPromise(); 3275 Local<Promise> GetPromise();
3242 3276
3243 /** 3277 /**
3244 * Resolve/reject the associated promise with a given value. 3278 * Resolve/reject the associated promise with a given value.
3245 * Ignored if the promise is no longer pending. 3279 * Ignored if the promise is no longer pending.
3246 */ 3280 */
3247 V8_DEPRECATE_SOON("Use maybe version", void Resolve(Handle<Value> value)); 3281 V8_DEPRECATE_SOON("Use maybe version", void Resolve(Handle<Value> value));
3282 // TODO(dcarney): mark V8_WARN_UNUSED_RESULT
3248 Maybe<bool> Resolve(Local<Context> context, Handle<Value> value); 3283 Maybe<bool> Resolve(Local<Context> context, Handle<Value> value);
3249 3284
3250 V8_DEPRECATE_SOON("Use maybe version", void Reject(Handle<Value> value)); 3285 V8_DEPRECATE_SOON("Use maybe version", void Reject(Handle<Value> value));
3286 // TODO(dcarney): mark V8_WARN_UNUSED_RESULT
3251 Maybe<bool> Reject(Local<Context> context, Handle<Value> value); 3287 Maybe<bool> Reject(Local<Context> context, Handle<Value> value);
3252 3288
3253 V8_INLINE static Resolver* Cast(Value* obj); 3289 V8_INLINE static Resolver* Cast(Value* obj);
3254 3290
3255 private: 3291 private:
3256 Resolver(); 3292 Resolver();
3257 static void CheckCast(Value* obj); 3293 static void CheckCast(Value* obj);
3258 }; 3294 };
3259 3295
3260 /** 3296 /**
3261 * Register a resolution/rejection handler with a promise. 3297 * Register a resolution/rejection handler with a promise.
3262 * The handler is given the respective resolution/rejection value as 3298 * The handler is given the respective resolution/rejection value as
3263 * an argument. If the promise is already resolved/rejected, the handler is 3299 * an argument. If the promise is already resolved/rejected, the handler is
3264 * invoked at the end of turn. 3300 * invoked at the end of turn.
3265 */ 3301 */
3266 V8_DEPRECATE_SOON("Use maybe version", 3302 V8_DEPRECATE_SOON("Use maybe version",
3267 Local<Promise> Chain(Handle<Function> handler)); 3303 Local<Promise> Chain(Handle<Function> handler));
3268 MaybeLocal<Promise> Chain(Local<Context> context, Handle<Function> handler); 3304 V8_WARN_UNUSED_RESULT MaybeLocal<Promise> Chain(Local<Context> context,
3305 Handle<Function> handler);
3269 3306
3270 V8_DEPRECATE_SOON("Use maybe version", 3307 V8_DEPRECATE_SOON("Use maybe version",
3271 Local<Promise> Catch(Handle<Function> handler)); 3308 Local<Promise> Catch(Handle<Function> handler));
3272 MaybeLocal<Promise> Catch(Local<Context> context, Handle<Function> handler); 3309 V8_WARN_UNUSED_RESULT MaybeLocal<Promise> Catch(Local<Context> context,
3310 Handle<Function> handler);
3273 3311
3274 V8_DEPRECATE_SOON("Use maybe version", 3312 V8_DEPRECATE_SOON("Use maybe version",
3275 Local<Promise> Then(Handle<Function> handler)); 3313 Local<Promise> Then(Handle<Function> handler));
3276 MaybeLocal<Promise> Then(Local<Context> context, Handle<Function> handler); 3314 V8_WARN_UNUSED_RESULT MaybeLocal<Promise> Then(Local<Context> context,
3315 Handle<Function> handler);
3277 3316
3278 /** 3317 /**
3279 * Returns true if the promise has at least one derived promise, and 3318 * Returns true if the promise has at least one derived promise, and
3280 * therefore resolve/reject handlers (including default handler). 3319 * therefore resolve/reject handlers (including default handler).
3281 */ 3320 */
3282 bool HasHandler(); 3321 bool HasHandler();
3283 3322
3284 V8_INLINE static Promise* Cast(Value* obj); 3323 V8_INLINE static Promise* Cast(Value* obj);
3285 3324
3286 private: 3325 private:
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
3634 }; 3673 };
3635 3674
3636 3675
3637 /** 3676 /**
3638 * An instance of the built-in Date constructor (ECMA-262, 15.9). 3677 * An instance of the built-in Date constructor (ECMA-262, 15.9).
3639 */ 3678 */
3640 class V8_EXPORT Date : public Object { 3679 class V8_EXPORT Date : public Object {
3641 public: 3680 public:
3642 static V8_DEPRECATE_SOON("Use maybe version.", 3681 static V8_DEPRECATE_SOON("Use maybe version.",
3643 Local<Value> New(Isolate* isolate, double time)); 3682 Local<Value> New(Isolate* isolate, double time));
3644 static MaybeLocal<Value> New(Local<Context> context, double time); 3683 static V8_WARN_UNUSED_RESULT MaybeLocal<Value> New(Local<Context> context,
3684 double time);
3645 3685
3646 /** 3686 /**
3647 * A specialization of Value::NumberValue that is more efficient 3687 * A specialization of Value::NumberValue that is more efficient
3648 * because we know the structure of this object. 3688 * because we know the structure of this object.
3649 */ 3689 */
3650 double ValueOf() const; 3690 double ValueOf() const;
3651 3691
3652 V8_INLINE static Date* Cast(v8::Value* obj); 3692 V8_INLINE static Date* Cast(v8::Value* obj);
3653 3693
3654 /** 3694 /**
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
3758 * described in ECMA-262, 15.10.4.1. 3798 * described in ECMA-262, 15.10.4.1.
3759 * 3799 *
3760 * For example, 3800 * For example,
3761 * RegExp::New(v8::String::New("foo"), 3801 * RegExp::New(v8::String::New("foo"),
3762 * static_cast<RegExp::Flags>(kGlobal | kMultiline)) 3802 * static_cast<RegExp::Flags>(kGlobal | kMultiline))
3763 * is equivalent to evaluating "/foo/gm". 3803 * is equivalent to evaluating "/foo/gm".
3764 */ 3804 */
3765 static V8_DEPRECATE_SOON("Use maybe version", 3805 static V8_DEPRECATE_SOON("Use maybe version",
3766 Local<RegExp> New(Handle<String> pattern, 3806 Local<RegExp> New(Handle<String> pattern,
3767 Flags flags)); 3807 Flags flags));
3768 static MaybeLocal<RegExp> New(Local<Context> context, Handle<String> pattern, 3808 static V8_WARN_UNUSED_RESULT MaybeLocal<RegExp> New(Local<Context> context,
3769 Flags flags); 3809 Handle<String> pattern,
3810 Flags flags);
3770 3811
3771 /** 3812 /**
3772 * Returns the value of the source property: a string representing 3813 * Returns the value of the source property: a string representing
3773 * the regular expression. 3814 * the regular expression.
3774 */ 3815 */
3775 Local<String> GetSource() const; 3816 Local<String> GetSource() const;
3776 3817
3777 /** 3818 /**
3778 * Returns the flags bit field. 3819 * Returns the flags bit field.
3779 */ 3820 */
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
4144 /** Creates a function template.*/ 4185 /** Creates a function template.*/
4145 static Local<FunctionTemplate> New( 4186 static Local<FunctionTemplate> New(
4146 Isolate* isolate, 4187 Isolate* isolate,
4147 FunctionCallback callback = 0, 4188 FunctionCallback callback = 0,
4148 Handle<Value> data = Handle<Value>(), 4189 Handle<Value> data = Handle<Value>(),
4149 Handle<Signature> signature = Handle<Signature>(), 4190 Handle<Signature> signature = Handle<Signature>(),
4150 int length = 0); 4191 int length = 0);
4151 4192
4152 /** Returns the unique function instance in the current execution context.*/ 4193 /** Returns the unique function instance in the current execution context.*/
4153 V8_DEPRECATE_SOON("Use maybe version", Local<Function> GetFunction()); 4194 V8_DEPRECATE_SOON("Use maybe version", Local<Function> GetFunction());
4154 MaybeLocal<Function> GetFunction(Local<Context> context); 4195 V8_WARN_UNUSED_RESULT MaybeLocal<Function> GetFunction(
4196 Local<Context> context);
4155 4197
4156 /** 4198 /**
4157 * Set the call-handler callback for a FunctionTemplate. This 4199 * Set the call-handler callback for a FunctionTemplate. This
4158 * callback is called whenever the function created from this 4200 * callback is called whenever the function created from this
4159 * FunctionTemplate is called. 4201 * FunctionTemplate is called.
4160 */ 4202 */
4161 void SetCallHandler(FunctionCallback callback, 4203 void SetCallHandler(FunctionCallback callback,
4162 Handle<Value> data = Handle<Value>()); 4204 Handle<Value> data = Handle<Value>());
4163 4205
4164 /** Set the predefined length property for the FunctionTemplate. */ 4206 /** Set the predefined length property for the FunctionTemplate. */
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
4305 * created from the ObjectTemplate. 4347 * created from the ObjectTemplate.
4306 */ 4348 */
4307 class V8_EXPORT ObjectTemplate : public Template { 4349 class V8_EXPORT ObjectTemplate : public Template {
4308 public: 4350 public:
4309 /** Creates an ObjectTemplate. */ 4351 /** Creates an ObjectTemplate. */
4310 static Local<ObjectTemplate> New(Isolate* isolate); 4352 static Local<ObjectTemplate> New(Isolate* isolate);
4311 static V8_DEPRECATE_SOON("Use isolate version", Local<ObjectTemplate> New()); 4353 static V8_DEPRECATE_SOON("Use isolate version", Local<ObjectTemplate> New());
4312 4354
4313 /** Creates a new instance of this template.*/ 4355 /** Creates a new instance of this template.*/
4314 V8_DEPRECATE_SOON("Use maybe version", Local<Object> NewInstance()); 4356 V8_DEPRECATE_SOON("Use maybe version", Local<Object> NewInstance());
4315 MaybeLocal<Object> NewInstance(Local<Context> context); 4357 V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(Local<Context> context);
4316 4358
4317 /** 4359 /**
4318 * Sets an accessor on the object template. 4360 * Sets an accessor on the object template.
4319 * 4361 *
4320 * Whenever the property with the given name is accessed on objects 4362 * Whenever the property with the given name is accessed on objects
4321 * created from this ObjectTemplate the getter and setter callbacks 4363 * created from this ObjectTemplate the getter and setter callbacks
4322 * are called instead of getting and setting the property directly 4364 * are called instead of getting and setting the property directly
4323 * on the JavaScript object. 4365 * on the JavaScript object.
4324 * 4366 *
4325 * \param name The name of the property for which an accessor is added. 4367 * \param name The name of the property for which an accessor is added.
(...skipping 1821 matching lines...) Expand 10 before | Expand all | Expand 10 after
6147 * 6189 *
6148 * The returned handle is valid until this TryCatch block has been destroyed. 6190 * The returned handle is valid until this TryCatch block has been destroyed.
6149 */ 6191 */
6150 Local<Value> Exception() const; 6192 Local<Value> Exception() const;
6151 6193
6152 /** 6194 /**
6153 * Returns the .stack property of the thrown object. If no .stack 6195 * Returns the .stack property of the thrown object. If no .stack
6154 * property is present an empty handle is returned. 6196 * property is present an empty handle is returned.
6155 */ 6197 */
6156 V8_DEPRECATE_SOON("Use maybe version.", Local<Value> StackTrace()) const; 6198 V8_DEPRECATE_SOON("Use maybe version.", Local<Value> StackTrace()) const;
6157 MaybeLocal<Value> StackTrace(Local<Context> context) const; 6199 V8_WARN_UNUSED_RESULT MaybeLocal<Value> StackTrace(
6200 Local<Context> context) const;
6158 6201
6159 /** 6202 /**
6160 * Returns the message associated with this exception. If there is 6203 * Returns the message associated with this exception. If there is
6161 * no message associated an empty handle is returned. 6204 * no message associated an empty handle is returned.
6162 * 6205 *
6163 * The returned handle is valid until this TryCatch block has been 6206 * The returned handle is valid until this TryCatch block has been
6164 * destroyed. 6207 * destroyed.
6165 */ 6208 */
6166 Local<v8::Message> Message() const; 6209 Local<v8::Message> Message() const;
6167 6210
(...skipping 1846 matching lines...) Expand 10 before | Expand all | Expand 10 after
8014 */ 8057 */
8015 8058
8016 8059
8017 } // namespace v8 8060 } // namespace v8
8018 8061
8019 8062
8020 #undef TYPE_CHECK 8063 #undef TYPE_CHECK
8021 8064
8022 8065
8023 #endif // V8_H_ 8066 #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