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

Unified Diff: src/d8.cc

Issue 98993002: Remove internal uses of deprecated MakeWeak. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased. More stuff. Created 7 years 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 | « no previous file | test/cctest/test-api.cc » ('j') | test/cctest/test-api.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/d8.cc
diff --git a/src/d8.cc b/src/d8.cc
index 7c5df463d334564347bc6e0fd273982a48f09efd..cc4a40a8f4b2afe6002850f3c55a287898f76562 100644
--- a/src/d8.cc
+++ b/src/d8.cc
@@ -48,6 +48,8 @@
#include <algorithm>
#endif // !V8_SHARED
+#include <utility>
Michael Starzinger 2013/12/02 15:34:10 nit: Can we move this up to the other system inclu
Sven Panne 2013/12/02 17:30:53 Nope, the presubmit check insists on this order: C
+
#ifdef V8_SHARED
#include "../include/v8-testing.h"
#endif // V8_SHARED
@@ -1097,16 +1099,14 @@ static char* ReadChars(Isolate* isolate, const char* name, int* size_out) {
return chars;
}
-static void ReadBufferWeakCallback(v8::Isolate* isolate,
- Persistent<ArrayBuffer>* array_buffer,
- uint8_t* data) {
- size_t byte_length =
- Local<ArrayBuffer>::New(isolate, *array_buffer)->ByteLength();
- isolate->AdjustAmountOfExternalAllocatedMemory(
- -static_cast<intptr_t>(byte_length));
-
- delete[] data;
- array_buffer->Reset();
+static void ReadBufferWeakCallback(
+ const WeakCallbackData<v8::ArrayBuffer,
+ std::pair<v8::Persistent<v8::ArrayBuffer>*,
+ uint8_t*> >& data) {
+ data.GetIsolate()->AdjustAmountOfExternalAllocatedMemory(
+ -data.GetValue()->ByteLength());
Michael Starzinger 2013/12/02 15:34:10 I guess there will be some casting problem between
Sven Panne 2013/12/02 17:30:53 To be honest, I would prefer to see a compiler war
+ delete[] data.GetParameter()->second;
+ data.GetParameter()->first->Reset();
}
@@ -1128,7 +1128,9 @@ void Shell::ReadBuffer(const v8::FunctionCallbackInfo<v8::Value>& args) {
}
Handle<v8::ArrayBuffer> buffer = ArrayBuffer::New(isolate, data, length);
v8::Persistent<v8::ArrayBuffer> weak_handle(isolate, buffer);
- weak_handle.MakeWeak(data, ReadBufferWeakCallback);
+ std::pair<v8::Persistent<v8::ArrayBuffer>*, uint8_t*> pair(&weak_handle,
+ data);
+ weak_handle.SetWeak(&pair, ReadBufferWeakCallback);
weak_handle.MarkIndependent();
isolate->AdjustAmountOfExternalAllocatedMemory(length);
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | test/cctest/test-api.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698