[Android] Out with the Android GR, in with the new unified C++ GR
[chromium-blink-merge.git] / gin / per_context_data.cc
blobb10c1a024f6c6bdcb4985b390964659afcfd21bc
1 // 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.
5 #include "gin/per_context_data.h"
7 #include "base/logging.h"
8 #include "gin/public/context_holder.h"
9 #include "gin/public/wrapper_info.h"
11 namespace gin {
13 PerContextData::PerContextData(ContextHolder* context_holder,
14 v8::Handle<v8::Context> context)
15 : context_holder_(context_holder),
16 runner_(NULL) {
17 context->SetAlignedPointerInEmbedderData(
18 kPerContextDataStartIndex + kEmbedderNativeGin, this);
21 PerContextData::~PerContextData() {
24 // static
25 PerContextData* PerContextData::From(v8::Handle<v8::Context> context) {
26 return static_cast<PerContextData*>(
27 context->GetAlignedPointerFromEmbedderData(kEncodedValueIndex));
30 } // namespace gin