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

Side by Side Diff: gin/per_context_data.h

Issue 60613003: Add a dependency from Gin to base (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « gin/modules/module_registry.cc ('k') | gin/per_context_data.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef GIN_PER_CONTEXT_DATA_H_ 5 #ifndef GIN_PER_CONTEXT_DATA_H_
6 #define GIN_PER_CONTEXT_DATA_H_ 6 #define GIN_PER_CONTEXT_DATA_H_
7 7
8 #include <vector>
9 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/scoped_vector.h"
10 #include "v8/include/v8.h" 11 #include "v8/include/v8.h"
11 12
12 namespace gin { 13 namespace gin {
13 14
14 class ContextSupplement { 15 class ContextSupplement {
15 public: 16 public:
16 ContextSupplement(); 17 ContextSupplement();
17 virtual ~ContextSupplement(); 18 virtual ~ContextSupplement();
18 19
19 virtual void Detach(v8::Handle<v8::Context> context) = 0; 20 virtual void Detach(v8::Handle<v8::Context> context) = 0;
20 21
21 private: 22 private:
22 DISALLOW_COPY_AND_ASSIGN(ContextSupplement); 23 DISALLOW_COPY_AND_ASSIGN(ContextSupplement);
23 }; 24 };
24 25
25 class PerContextData { 26 class PerContextData {
26 public: 27 public:
27 explicit PerContextData(v8::Handle<v8::Context> context); 28 explicit PerContextData(v8::Handle<v8::Context> context);
28 ~PerContextData(); 29 ~PerContextData();
29 30
30 // Can return NULL after the ContextHolder has detached from context. 31 // Can return NULL after the ContextHolder has detached from context.
31 static PerContextData* From(v8::Handle<v8::Context>); 32 static PerContextData* From(v8::Handle<v8::Context>);
32 void Detach(v8::Handle<v8::Context> context); 33 void Detach(v8::Handle<v8::Context> context);
33 34
34 // Takes ownership of the supplement. 35 void AddSupplement(scoped_ptr<ContextSupplement> supplement);
35 void AddSupplement(ContextSupplement* supplement);
36 36
37 private: 37 private:
38 typedef std::vector<ContextSupplement*> SuplementVector; 38 typedef ScopedVector<ContextSupplement> SuplementVector;
39 39
40 // Owning reference.
41 SuplementVector supplements_; 40 SuplementVector supplements_;
42 41
43 DISALLOW_COPY_AND_ASSIGN(PerContextData); 42 DISALLOW_COPY_AND_ASSIGN(PerContextData);
44 }; 43 };
45 44
46 } // namespace gin 45 } // namespace gin
47 46
48 #endif // GIN_PER_CONTEXT_DATA_H_ 47 #endif // GIN_PER_CONTEXT_DATA_H_
OLDNEW
« no previous file with comments | « gin/modules/module_registry.cc ('k') | gin/per_context_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698