This patch combine three patch which is related to "--gcov" flag.
[platform/framework/web/chromium-efl.git] / gin / context_holder.cc
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.
4
5 #include "gin/public/context_holder.h"
6
7 #include <memory>
8
9 #include "base/check.h"
10 #include "gin/per_context_data.h"
11
12 namespace gin {
13
14 ContextHolder::ContextHolder(v8::Isolate* isolate)
15     : isolate_(isolate) {
16 }
17
18 ContextHolder::~ContextHolder() {
19   // PerContextData needs to be destroyed before the context.
20   data_.reset();
21 }
22
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);
28 }
29
30 }  // namespace gin