1 // Copyright 2013 The Chromium Authors
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/public/context_holder.h"
9 #include "base/check.h"
10 #include "gin/per_context_data.h"
14 ContextHolder::ContextHolder(v8::Isolate* isolate)
18 ContextHolder::~ContextHolder() {
19 // PerContextData needs to be destroyed before the context.
23 void ContextHolder::SetContext(v8::Local<v8::Context> context) {
24 DCHECK(context_.IsEmpty());
25 context_.Reset(isolate_, context);
26 context_.AnnotateStrongRetainer("gin::ContextHolder::context_");
27 data_ = std::make_unique<PerContextData>(this, context);