diff --git a/include/v8-util.h b/include/v8-util.h index c54418aa25..159027d317 100644 --- a/include/v8-util.h +++ b/include/v8-util.h @@ -537,7 +537,6 @@ class StdGlobalValueMap : public GlobalValueMap { : GlobalValueMap(isolate) {} }; - class DefaultPersistentValueVectorTraits { public: typedef std::vector Impl; @@ -562,7 +561,6 @@ class DefaultPersistentValueVectorTraits { } }; - /** * A vector wrapper that safely stores Global values. * C++11 embedders don't need this class, as they can use Global @@ -573,8 +571,8 @@ class DefaultPersistentValueVectorTraits { * PersistentContainerValue, with all conversion into and out of V8 * handles being transparently handled by this class. */ -template -class PersistentValueVector { +template +class V8_DEPRECATE_SOON("Use std::vector>.") PersistentValueVector { public: explicit PersistentValueVector(Isolate* isolate) : isolate_(isolate) { } diff --git a/src/api/api.cc b/src/api/api.cc index 06977d5507..e5433eb749 100644 --- a/src/api/api.cc +++ b/src/api/api.cc @@ -449,11 +449,7 @@ class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { #endif // V8_SANDBOXED_POINTERS struct SnapshotCreatorData { - explicit SnapshotCreatorData(Isolate* v8_isolate) - : isolate_(v8_isolate), - default_context_(), - contexts_(v8_isolate), - created_(false) {} + explicit SnapshotCreatorData(Isolate* v8_isolate) : isolate_(v8_isolate) {} static SnapshotCreatorData* cast(void* data) { return reinterpret_cast(data); @@ -463,9 +459,9 @@ struct SnapshotCreatorData { Isolate* isolate_; Persistent default_context_; SerializeInternalFieldsCallback default_embedder_fields_serializer_; - PersistentValueVector contexts_; + std::vector> contexts_; std::vector embedder_fields_serializers_; - bool created_; + bool created_ = false; }; } // namespace @@ -530,8 +526,8 @@ size_t SnapshotCreator::AddContext(Local context, DCHECK(!data->created_); Isolate* v8_isolate = data->isolate_; CHECK_EQ(v8_isolate, context->GetIsolate()); - size_t index = data->contexts_.Size(); - data->contexts_.Append(context); + size_t index = data->contexts_.size(); + data->contexts_.emplace_back(v8_isolate, context); data->embedder_fields_serializers_.push_back(callback); return index; } @@ -607,11 +603,12 @@ void ConvertSerializedObjectsToFixedArray(i::Isolate* i_isolate) { StartupData SnapshotCreator::CreateBlob( SnapshotCreator::FunctionCodeHandling function_code_handling) { SnapshotCreatorData* data = SnapshotCreatorData::cast(data_); - i::Isolate* i_isolate = reinterpret_cast(data->isolate_); + Isolate* isolate = data->isolate_; + i::Isolate* i_isolate = reinterpret_cast(isolate); DCHECK(!data->created_); DCHECK(!data->default_context_.IsEmpty()); - const int num_additional_contexts = static_cast(data->contexts_.Size()); + const int num_additional_contexts = static_cast(data->contexts_.size()); const int num_contexts = num_additional_contexts + 1; // The default context. // Create and store lists of embedder-provided data needed during @@ -625,7 +622,7 @@ StartupData SnapshotCreator::CreateBlob( ConvertSerializedObjectsToFixedArray( data->default_context_.Get(data->isolate_)); for (int i = 0; i < num_additional_contexts; i++) { - ConvertSerializedObjectsToFixedArray(data->contexts_.Get(i)); + ConvertSerializedObjectsToFixedArray(data->contexts_[i].Get(isolate)); } // We need to store the global proxy size upfront in case we need the @@ -635,7 +632,7 @@ StartupData SnapshotCreator::CreateBlob( i::AllocationType::kOld); for (int i = 0; i < num_additional_contexts; i++) { i::Handle context = - v8::Utils::OpenHandle(*data->contexts_.Get(i)); + v8::Utils::OpenHandle(*data->contexts_[i].Get(isolate)); global_proxy_sizes->set(i, i::Smi::FromInt(context->global_proxy().Size())); } @@ -673,10 +670,10 @@ StartupData SnapshotCreator::CreateBlob( data->default_context_.Reset(); for (int i = 0; i < num_additional_contexts; i++) { i::Handle context = - v8::Utils::OpenHandle(*data->contexts_.Get(i)); + v8::Utils::OpenHandle(*data->contexts_[i].Get(isolate)); contexts.push_back(*context); } - data->contexts_.Clear(); + data->contexts_.clear(); } // Check that values referenced by global/eternal handles are accounted for. diff --git a/src/debug/debug-interface.cc b/src/debug/debug-interface.cc index d1fada5aa1..599c6ab89a 100644 --- a/src/debug/debug-interface.cc +++ b/src/debug/debug-interface.cc @@ -872,7 +872,7 @@ int Location::GetColumnNumber() const { bool Location::IsEmpty() const { return is_empty_; } void GetLoadedScripts(Isolate* v8_isolate, - PersistentValueVector