Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(180)

Side by Side Diff: gin/per_context_data.h

Issue 62333018: Implement Asynchronous Module Definition API for Mojo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moar testing Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #ifndef GIN_PER_CONTEXT_DATA_H_
6 #define GIN_PER_CONTEXT_DATA_H_
7
8 #include <vector>
9 #include "base/basictypes.h"
10 #include "v8/include/v8.h"
11
12 namespace gin {
13
14 class ContextSupplement {
15 public:
16 ContextSupplement();
17 virtual ~ContextSupplement();
18
19 virtual void Detach(v8::Handle<v8::Context> context) = 0;
20
21 private:
22 DISALLOW_COPY_AND_ASSIGN(ContextSupplement);
23 };
24
25 class PerContextData {
26 public:
27 explicit PerContextData(v8::Handle<v8::Context> context);
28 ~PerContextData();
29
30 // Can return NULL after the ContextHolder has detached from context.
31 static PerContextData* From(v8::Handle<v8::Context>);
32 void Detach(v8::Handle<v8::Context> context);
33
34 // Takes ownership of the supplement.
35 void AddSupplement(ContextSupplement* supplement);
36
37 private:
38 typedef std::vector<ContextSupplement*> SuplementVector;
39
40 // Owning reference.
41 SuplementVector supplements_;
42
43 DISALLOW_COPY_AND_ASSIGN(PerContextData);
44 };
45
46 } // namespace gin
47
48 #endif // GIN_PER_CONTEXT_DATA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698