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

Side by Side Diff: src/api.cc

Issue 215893005: Add API for adding and removing CallCompletedCallbacks to Isolate (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « include/v8.h ('k') | no next file » | 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 6666 matching lines...) Expand 10 before | Expand all | Expand 10 after
6677 heap_statistics->used_heap_size_ = heap->SizeOfObjects(); 6677 heap_statistics->used_heap_size_ = heap->SizeOfObjects();
6678 heap_statistics->heap_size_limit_ = heap->MaxReserved(); 6678 heap_statistics->heap_size_limit_ = heap->MaxReserved();
6679 } 6679 }
6680 6680
6681 6681
6682 void Isolate::SetEventLogger(LogEventCallback that) { 6682 void Isolate::SetEventLogger(LogEventCallback that) {
6683 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 6683 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6684 isolate->set_event_logger(that); 6684 isolate->set_event_logger(that);
6685 } 6685 }
6686 6686
6687
6688 void Isolate::AddCallCompletedCallback(CallCompletedCallback callback) {
6689 if (callback == NULL) return;
6690 // TODO(jochen): Make this per isolate.
6691 i::V8::AddCallCompletedCallback(callback);
6692 }
6693
6694
6695 void Isolate::RemoveCallCompletedCallback(CallCompletedCallback callback) {
6696 // TODO(jochen): Make this per isolate.
6697 i::V8::RemoveCallCompletedCallback(callback);
6698 }
6699
6700
6687 String::Utf8Value::Utf8Value(v8::Handle<v8::Value> obj) 6701 String::Utf8Value::Utf8Value(v8::Handle<v8::Value> obj)
6688 : str_(NULL), length_(0) { 6702 : str_(NULL), length_(0) {
6689 i::Isolate* isolate = i::Isolate::Current(); 6703 i::Isolate* isolate = i::Isolate::Current();
6690 if (obj.IsEmpty()) return; 6704 if (obj.IsEmpty()) return;
6691 ENTER_V8(isolate); 6705 ENTER_V8(isolate);
6692 i::HandleScope scope(isolate); 6706 i::HandleScope scope(isolate);
6693 TryCatch try_catch; 6707 TryCatch try_catch;
6694 Handle<String> str = obj->ToString(); 6708 Handle<String> str = obj->ToString();
6695 if (str.IsEmpty()) return; 6709 if (str.IsEmpty()) return;
6696 i::Handle<i::String> i_str = Utils::OpenHandle(*str); 6710 i::Handle<i::String> i_str = Utils::OpenHandle(*str);
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after
7651 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7665 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7652 Address callback_address = 7666 Address callback_address =
7653 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7667 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7654 VMState<EXTERNAL> state(isolate); 7668 VMState<EXTERNAL> state(isolate);
7655 ExternalCallbackScope call_scope(isolate, callback_address); 7669 ExternalCallbackScope call_scope(isolate, callback_address);
7656 callback(info); 7670 callback(info);
7657 } 7671 }
7658 7672
7659 7673
7660 } } // namespace v8::internal 7674 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698