Supervised user blacklist: Add downloader class to download a blacklist if needed.
[chromium-blink-merge.git] / gin / function_template.cc
blobf76a05bea6ba3298e45d2b853123d0420f081991
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "gin/function_template.h"
7 namespace gin {
9 namespace internal {
11 CallbackHolderBase::CallbackHolderBase(v8::Isolate* isolate)
12 : v8_ref_(isolate, v8::External::New(isolate, this)) {
13 v8_ref_.SetWeak(this, &CallbackHolderBase::WeakCallback);
16 CallbackHolderBase::~CallbackHolderBase() {
17 DCHECK(v8_ref_.IsEmpty());
20 v8::Handle<v8::External> CallbackHolderBase::GetHandle(v8::Isolate* isolate) {
21 return v8::Local<v8::External>::New(isolate, v8_ref_);
24 // static
25 void CallbackHolderBase::WeakCallback(
26 const v8::WeakCallbackData<v8::External, CallbackHolderBase>& data) {
27 data.GetParameter()->v8_ref_.Reset();
28 delete data.GetParameter();
31 } // namespace internal
33 } // namespace gin