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

Unified Diff: chrome/renderer/extensions/object_backed_native_handler.h

Issue 16032015: Extensions: pass ChromeV8Context around instead of v8::Handle. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/extensions/object_backed_native_handler.h
diff --git a/chrome/renderer/extensions/object_backed_native_handler.h b/chrome/renderer/extensions/object_backed_native_handler.h
index 0439adfed5de30ad755b421b191af58014235c9b..c4ac7075571bcac7f04269020959ac9eadb52d9f 100644
--- a/chrome/renderer/extensions/object_backed_native_handler.h
+++ b/chrome/renderer/extensions/object_backed_native_handler.h
@@ -15,13 +15,14 @@
#include "v8/include/v8.h"
namespace extensions {
+class ChromeV8Context;
// An ObjectBackedNativeHandler is a factory for JS objects with functions on
// them that map to native C++ functions. Subclasses should call RouteFunction()
// in their constructor to define functions on the created JS objects.
class ObjectBackedNativeHandler : public NativeHandler {
public:
- explicit ObjectBackedNativeHandler(v8::Handle<v8::Context> context);
+ explicit ObjectBackedNativeHandler(ChromeV8Context* context);
virtual ~ObjectBackedNativeHandler();
// Create an object with bindings to the native functions defined through
@@ -38,10 +39,13 @@ class ObjectBackedNativeHandler : public NativeHandler {
void RouteFunction(const std::string& name,
const HandlerFunction& handler_function);
- v8::Handle<v8::Context> v8_context() { return v8_context_.get(); }
+ v8::Handle<v8::Context> v8_context();
not at google - send to devlin 2013/05/29 15:55:13 can this be made to return a ChromeV8Context* (and
marja 2013/05/29 16:56:33 Done.
virtual void Invalidate() OVERRIDE;
+ protected:
+ ChromeV8Context* context_;
not at google - send to devlin 2013/05/29 15:55:13 then this can be private
marja 2013/05/29 16:56:33 Done.
+
private:
// Callback for RouteFunction which routes the V8 call to the correct
// base::Bound callback.
@@ -63,10 +67,6 @@ class ObjectBackedNativeHandler : public NativeHandler {
typedef std::vector<v8::Persistent<v8::Object> > RouterData;
RouterData router_data_;
- // TODO(kalman): Just pass around a ChromeV8Context. It already has a
- // persistent handle to this context.
- ScopedPersistent<v8::Context> v8_context_;
-
ScopedPersistent<v8::ObjectTemplate> object_template_;
DISALLOW_COPY_AND_ASSIGN(ObjectBackedNativeHandler);

Powered by Google App Engine
This is Rietveld 408576698