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

Unified Diff: src/api.cc

Issue 174056: Add support for forceful termination of JavaScript execution. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/v8.h ('k') | src/arm/codegen-arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
===================================================================
--- src/api.cc (revision 2717)
+++ src/api.cc (working copy)
@@ -75,7 +75,7 @@
i::V8::FatalProcessOutOfMemory(NULL); \
} \
bool call_depth_is_zero = thread_local.CallDepthIsZero(); \
- i::Top::optional_reschedule_exception(call_depth_is_zero); \
+ i::Top::OptionalRescheduleException(call_depth_is_zero, false); \
return value; \
} \
} while (false)
@@ -1208,6 +1208,11 @@
}
+bool v8::TryCatch::CanContinue() const {
+ return can_continue_;
+}
+
+
v8::Local<Value> v8::TryCatch::Exception() const {
if (HasCaught()) {
// Check for out of memory exception.
@@ -3354,6 +3359,34 @@
return 0;
}
+
+int V8::GetCurrentThreadId() {
+ API_ENTRY_CHECK("V8::GetCurrentThreadId()");
+ EnsureInitialized("V8::GetCurrentThreadId()");
+ return i::Top::thread_id();
+}
+
+
+void V8::TerminateExecution(int thread_id) {
+ if (!i::V8::IsRunning()) return;
+ API_ENTRY_CHECK("V8::GetCurrentThreadId()");
+ // If the thread_id identifies the current thread just terminate
+ // execution right away. Otherwise, ask the thread manager to
+ // terminate the thread with the given id if any.
+ if (thread_id == i::Top::thread_id()) {
+ i::StackGuard::TerminateExecution();
+ } else {
+ i::ThreadManager::TerminateExecution(thread_id);
+ }
+}
+
+
+void V8::TerminateExecution() {
+ if (!i::V8::IsRunning()) return;
+ i::StackGuard::TerminateExecution();
+}
+
+
String::Utf8Value::Utf8Value(v8::Handle<v8::Value> obj) {
EnsureInitialized("v8::String::Utf8Value::Utf8Value()");
if (obj.IsEmpty()) {
« no previous file with comments | « include/v8.h ('k') | src/arm/codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698