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

Side by Side Diff: chrome/renderer/extensions/native_handler.h

Issue 12378077: Attempting to fix problems in 11571014. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: oops Created 7 years, 9 months 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CHROME_RENDERER_EXTENSIONS_NATIVE_HANDLER_H_ 5 #ifndef CHROME_RENDERER_EXTENSIONS_NATIVE_HANDLER_H_
6 #define CHROME_RENDERER_EXTENSIONS_NATIVE_HANDLER_H_ 6 #define CHROME_RENDERER_EXTENSIONS_NATIVE_HANDLER_H_
7 7
8 #include "v8/include/v8.h" 8 #include "v8/include/v8.h"
9 9
10 namespace extensions { 10 namespace extensions {
11 11
12 // NativeHandlers are intended to be used with a ModuleSystem. The ModuleSystem 12 // NativeHandlers are intended to be used with a ModuleSystem. The ModuleSystem
13 // will assume ownership of the NativeHandler, and as a ModuleSystem is tied to 13 // will assume ownership of the NativeHandler, and as a ModuleSystem is tied to
14 // a single v8::Context, this implies that NativeHandlers will also be tied to 14 // a single v8::Context, this implies that NativeHandlers will also be tied to
15 // a single v8::Context. 15 // a single v8::Context.
16 // TODO(koz): Rename this to NativeJavaScriptModule. 16 // TODO(koz): Rename this to NativeJavaScriptModule.
17 class NativeHandler { 17 class NativeHandler {
18 public: 18 public:
19 virtual ~NativeHandler() {} 19 NativeHandler();
20 virtual ~NativeHandler();
20 21
21 // Create a new instance of the object this handler specifies. 22 // Create a new instance of the object this handler specifies.
22 virtual v8::Handle<v8::Object> NewInstance() = 0; 23 virtual v8::Handle<v8::Object> NewInstance() = 0;
24
25 // Invalidate this object so it cannot be used any more. This is needed
26 // because it's possible for this to outlive its owner context. Invalidate
27 // must be called before this happens.
28 //
29 // Subclasses should override to invalidate their own V8 state. If they do
30 // they must call their superclass' Invalidate().
31 virtual void Invalidate();
32
33 protected:
34 // Allow subclasses to query valid state.
35 bool is_valid() { return is_valid_; }
36
37 private:
38 bool is_valid_;
23 }; 39 };
24 40
25 } // extensions 41 } // extensions
26 42
27 #endif // CHROME_RENDERER_EXTENSIONS_NATIVE_HANDLER_H_ 43 #endif // CHROME_RENDERER_EXTENSIONS_NATIVE_HANDLER_H_
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/module_system.cc ('k') | chrome/renderer/extensions/native_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698