summaryrefslogtreecommitdiffstats
path: root/extensions/renderer/messaging_bindings.cc
diff options
context:
space:
mode:
authordcarney <dcarney@chromium.org>2015-04-22 06:32:45 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-22 13:33:03 +0000
commit7df76108c7f344491a1e9017320e1d71624f4cbd (patch)
tree7089fe32b98feaa80850aade0707d79254ff1490 /extensions/renderer/messaging_bindings.cc
parentc096020684b111a8ba7cf94f549841afdb0c96d1 (diff)
downloadchromium_src-7df76108c7f344491a1e9017320e1d71624f4cbd.zip
chromium_src-7df76108c7f344491a1e9017320e1d71624f4cbd.tar.gz
chromium_src-7df76108c7f344491a1e9017320e1d71624f4cbd.tar.bz2
convert last chromium weak callback to phantom
TBR=kalman@chromium.org BUG= Review URL: https://codereview.chromium.org/1102573002 Cr-Commit-Position: refs/heads/master@{#326285}
Diffstat (limited to 'extensions/renderer/messaging_bindings.cc')
-rw-r--r--extensions/renderer/messaging_bindings.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/extensions/renderer/messaging_bindings.cc b/extensions/renderer/messaging_bindings.cc
index dab2113..1266e5b 100644
--- a/extensions/renderer/messaging_bindings.cc
+++ b/extensions/renderer/messaging_bindings.cc
@@ -186,15 +186,21 @@ class ExtensionImpl : public ObjectBackedNativeHandler {
v8::Handle<v8::Function> callback,
v8::Isolate* isolate) {
GCCallback* cb = new GCCallback(object, callback, isolate);
- cb->object_.SetWeak(cb, NearDeathCallback);
+ cb->object_.SetWeak(cb, FirstWeakCallback,
+ v8::WeakCallbackType::kParameter);
}
private:
- static void NearDeathCallback(
- const v8::WeakCallbackData<v8::Object, GCCallback>& data) {
+ static void FirstWeakCallback(
+ const v8::WeakCallbackInfo<GCCallback>& data) {
// v8 says we need to explicitly reset weak handles from their callbacks.
// It's not implicit as one might expect.
data.GetParameter()->object_.Reset();
+ data.SetSecondPassCallback(SecondWeakCallback);
+ }
+
+ static void SecondWeakCallback(
+ const v8::WeakCallbackInfo<GCCallback>& data) {
base::MessageLoop::current()->PostTask(
FROM_HERE,
base::Bind(&GCCallback::RunCallback,