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

Unified Diff: src/global-handles.cc

Issue 14908004: add weakcallback without persistent copying (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: missed some instances Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/global-handles.h ('k') | src/runtime.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/global-handles.cc
diff --git a/src/global-handles.cc b/src/global-handles.cc
index 6d17a9a25fac4bdf65da975bcdc7c9e67f3fe9b2..29432bb5b7c7782f60f9798239fcbe5602c018f5 100644
--- a/src/global-handles.cc
+++ b/src/global-handles.cc
@@ -235,7 +235,7 @@ class GlobalHandles::Node {
void MakeWeak(GlobalHandles* global_handles,
void* parameter,
- WeakReferenceCallback weak_reference_callback,
+ RevivableCallback weak_reference_callback,
NearDeathCallback near_death_callback) {
ASSERT(state() != FREE);
set_state(WEAK);
@@ -267,7 +267,7 @@ class GlobalHandles::Node {
set_state(NEAR_DEATH);
set_parameter(NULL);
- v8::Persistent<v8::Object> object = ToApi<v8::Object>(handle());
+ v8::Persistent<v8::Value> object = ToApi<v8::Value>(handle());
{
// Check that we are not passing a finalized external string to
// the callback.
@@ -279,9 +279,11 @@ class GlobalHandles::Node {
VMState<EXTERNAL> state(isolate);
if (near_death_callback_ != NULL) {
if (IsWeakCallback::decode(flags_)) {
- WeakReferenceCallback callback =
- reinterpret_cast<WeakReferenceCallback>(near_death_callback_);
- callback(object, par);
+ RevivableCallback callback =
+ reinterpret_cast<RevivableCallback>(near_death_callback_);
+ callback(reinterpret_cast<v8::Isolate*>(isolate),
+ &object,
+ par);
} else {
near_death_callback_(reinterpret_cast<v8::Isolate*>(isolate),
object,
@@ -493,9 +495,9 @@ void GlobalHandles::Destroy(Object** location) {
void GlobalHandles::MakeWeak(Object** location,
void* parameter,
- WeakReferenceCallback weak_reference_callback,
+ RevivableCallback weak_reference_callback,
NearDeathCallback near_death_callback) {
- ASSERT(near_death_callback != NULL);
+ ASSERT((weak_reference_callback == NULL) != (near_death_callback == NULL));
Node::FromLocation(location)->MakeWeak(this,
parameter,
weak_reference_callback,
« no previous file with comments | « src/global-handles.h ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698