fix compile error when use PersistentValueMap.
In PersistentValueMap, SetWeak function should supply WeakCallbackType arguments. Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng Change-Id: I70a59e90b7ea0a10f695419e57ae9bfb8d5ba852 Reviewed-on: https://chromium-review.googlesource.com/684002 Commit-Queue: Marja Hölttä <marja@chromium.org> Reviewed-by: Marja Hölttä <marja@chromium.org> Cr-Commit-Position: refs/heads/master@{#48529}
This commit is contained in:
parent
68a16b637d
commit
39b2227bbd
1
AUTHORS
1
AUTHORS
@ -133,6 +133,7 @@ Vlad Burlik <vladbph@gmail.com>
|
||||
Vladimir Krivosheev <develar@gmail.com>
|
||||
Vladimir Shutoff <vovan@shutoff.ru>
|
||||
Wiktor Garbacz <wiktor.garbacz@gmail.com>
|
||||
Yong Wang <ccyongwang@tencent.com>
|
||||
Yu Yin <xwafish@gmail.com>
|
||||
Zac Hansen <xaxxon@gmail.com>
|
||||
Zhongping Wang <kewpie.w.zp@gmail.com>
|
||||
|
@ -393,9 +393,14 @@ class PersistentValueMap : public PersistentValueMapBase<K, V, Traits> {
|
||||
*/
|
||||
Global<V> SetUnique(const K& key, Global<V>* persistent) {
|
||||
if (Traits::kCallbackType != kNotWeak) {
|
||||
WeakCallbackType callback_type =
|
||||
Traits::kCallbackType == kWeakWithInternalFields
|
||||
? WeakCallbackType::kInternalFields
|
||||
: WeakCallbackType::kParameter;
|
||||
Local<V> value(Local<V>::New(this->isolate(), *persistent));
|
||||
persistent->template SetWeak<typename Traits::WeakCallbackDataType>(
|
||||
Traits::WeakCallbackParameter(this, key, value), WeakCallback);
|
||||
Traits::WeakCallbackParameter(this, key, value), WeakCallback,
|
||||
callback_type);
|
||||
}
|
||||
PersistentContainerValue old_value =
|
||||
Traits::Set(this->impl(), key, this->ClearAndLeak(persistent));
|
||||
|
@ -27314,3 +27314,19 @@ TEST(PrimitiveArray) {
|
||||
CHECK(array->Get(3)->IsBoolean());
|
||||
CHECK(array->Get(4)->IsNull());
|
||||
}
|
||||
|
||||
TEST(PersistentValueMap) {
|
||||
v8::Isolate* isolate = CcTest::isolate();
|
||||
v8::HandleScope scope(isolate);
|
||||
LocalContext env;
|
||||
|
||||
v8::PersistentValueMap<
|
||||
std::string, v8::Value,
|
||||
v8::DefaultPersistentValueMapTraits<std::string, v8::Value>>
|
||||
map(isolate);
|
||||
v8::Local<v8::Value> value =
|
||||
v8::String::NewFromUtf8(isolate, "value",
|
||||
v8::NewStringType::kInternalized)
|
||||
.ToLocalChecked();
|
||||
map.Set("key", value);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user