blob: b10c1a024f6c6bdcb4985b390964659afcfd21bc [file] [log] [blame]
[email protected]97f21ca2013-11-17 17:46:071// 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.
4
5#include "gin/per_context_data.h"
6
[email protected]855ab432013-11-18 17:09:367#include "base/logging.h"
[email protected]36e374082013-12-06 01:51:178#include "gin/public/context_holder.h"
[email protected]c07006b2013-11-20 03:01:449#include "gin/public/wrapper_info.h"
[email protected]97f21ca2013-11-17 17:46:0710
11namespace gin {
12
[email protected]7f12ca72014-02-28 22:11:5313PerContextData::PerContextData(ContextHolder* context_holder,
14 v8::Handle<v8::Context> context)
15 : context_holder_(context_holder),
16 runner_(NULL) {
[email protected]36e374082013-12-06 01:51:1717 context->SetAlignedPointerInEmbedderData(
18 kPerContextDataStartIndex + kEmbedderNativeGin, this);
[email protected]97f21ca2013-11-17 17:46:0719}
20
21PerContextData::~PerContextData() {
[email protected]97f21ca2013-11-17 17:46:0722}
23
[email protected]1771610d2014-02-27 06:08:2424// static
[email protected]97f21ca2013-11-17 17:46:0725PerContextData* PerContextData::From(v8::Handle<v8::Context> context) {
26 return static_cast<PerContextData*>(
27 context->GetAlignedPointerFromEmbedderData(kEncodedValueIndex));
28}
29
[email protected]97f21ca2013-11-17 17:46:0730} // namespace gin