| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CONTENT_RENDERER_JAVA_GIN_JAVA_BRIDGE_OBJECT_H_ | 5 #ifndef CONTENT_RENDERER_JAVA_GIN_JAVA_BRIDGE_OBJECT_H_ |
| 6 #define CONTENT_RENDERER_JAVA_GIN_JAVA_BRIDGE_OBJECT_H_ | 6 #define CONTENT_RENDERER_JAVA_GIN_JAVA_BRIDGE_OBJECT_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "content/renderer/java/gin_java_bridge_dispatcher.h" | 12 #include "content/renderer/java/gin_java_bridge_dispatcher.h" |
| 13 #include "gin/handle.h" | 13 #include "gin/handle.h" |
| 14 #include "gin/interceptor.h" | 14 #include "gin/interceptor.h" |
| 15 #include "gin/object_template_builder.h" | 15 #include "gin/object_template_builder.h" |
| 16 #include "gin/wrappable.h" | 16 #include "gin/wrappable.h" |
| 17 #include "v8/include/v8-util.h" |
| 17 | 18 |
| 18 namespace blink { | 19 namespace blink { |
| 19 class WebFrame; | 20 class WebFrame; |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace content { | 23 namespace content { |
| 23 | 24 |
| 24 class GinJavaBridgeValueConverter; | 25 class GinJavaBridgeValueConverter; |
| 25 | 26 |
| 26 class GinJavaBridgeObject : public gin::Wrappable<GinJavaBridgeObject>, | 27 class GinJavaBridgeObject : public gin::Wrappable<GinJavaBridgeObject>, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 48 static GinJavaBridgeObject* InjectAnonymous( | 49 static GinJavaBridgeObject* InjectAnonymous( |
| 49 const base::WeakPtr<GinJavaBridgeDispatcher>& dispatcher, | 50 const base::WeakPtr<GinJavaBridgeDispatcher>& dispatcher, |
| 50 GinJavaBridgeDispatcher::ObjectID object_id); | 51 GinJavaBridgeDispatcher::ObjectID object_id); |
| 51 | 52 |
| 52 private: | 53 private: |
| 53 GinJavaBridgeObject(v8::Isolate* isolate, | 54 GinJavaBridgeObject(v8::Isolate* isolate, |
| 54 const base::WeakPtr<GinJavaBridgeDispatcher>& dispatcher, | 55 const base::WeakPtr<GinJavaBridgeDispatcher>& dispatcher, |
| 55 GinJavaBridgeDispatcher::ObjectID object_id); | 56 GinJavaBridgeDispatcher::ObjectID object_id); |
| 56 ~GinJavaBridgeObject() override; | 57 ~GinJavaBridgeObject() override; |
| 57 | 58 |
| 59 v8::Local<v8::FunctionTemplate> GetFunctionTemplate(v8::Isolate* isolate, |
| 60 const std::string& name); |
| 58 v8::Handle<v8::Value> InvokeMethod(const std::string& name, | 61 v8::Handle<v8::Value> InvokeMethod(const std::string& name, |
| 59 gin::Arguments* args); | 62 gin::Arguments* args); |
| 60 | 63 |
| 61 base::WeakPtr<GinJavaBridgeDispatcher> dispatcher_; | 64 base::WeakPtr<GinJavaBridgeDispatcher> dispatcher_; |
| 62 GinJavaBridgeDispatcher::ObjectID object_id_; | 65 GinJavaBridgeDispatcher::ObjectID object_id_; |
| 63 scoped_ptr<GinJavaBridgeValueConverter> converter_; | 66 scoped_ptr<GinJavaBridgeValueConverter> converter_; |
| 64 std::map<std::string, bool> known_methods_; | 67 std::map<std::string, bool> known_methods_; |
| 68 v8::StdPersistentValueMap<std::string, v8::FunctionTemplate> template_cache_; |
| 65 | 69 |
| 66 DISALLOW_COPY_AND_ASSIGN(GinJavaBridgeObject); | 70 DISALLOW_COPY_AND_ASSIGN(GinJavaBridgeObject); |
| 67 }; | 71 }; |
| 68 | 72 |
| 69 } // namespace content | 73 } // namespace content |
| 70 | 74 |
| 71 #endif // CONTENT_RENDERER_JAVA_GIN_JAVA_BRIDGE_OBJECT_H_ | 75 #endif // CONTENT_RENDERER_JAVA_GIN_JAVA_BRIDGE_OBJECT_H_ |
| OLD | NEW |