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

Unified Diff: content/browser/renderer_host/java/java_bridge_dispatcher_host.h

Issue 8834013: Fix a race condition in the Java Bridge when adding objects (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed nits Created 9 years 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: content/browser/renderer_host/java/java_bridge_dispatcher_host.h
diff --git a/content/browser/renderer_host/java/java_bridge_dispatcher_host.h b/content/browser/renderer_host/java/java_bridge_dispatcher_host.h
index c4fceef8e0bf3500949cb6f1f0eb2ff565e30241..6f574aea3d6c54c579d27d9e0f87c5785a4f221b 100644
--- a/content/browser/renderer_host/java/java_bridge_dispatcher_host.h
+++ b/content/browser/renderer_host/java/java_bridge_dispatcher_host.h
@@ -8,16 +8,22 @@
#include "base/memory/ref_counted.h"
#include "base/string16.h"
+#include "content/browser/renderer_host/render_view_host_observer.h"
-class JavaBridgeChannelHost;
+class NPChannelBase;
class RenderViewHost;
+class RouteIDGenerator;
struct NPObject;
+struct NPVariant_Param;
+struct _NPVariant;
+typedef _NPVariant NPVariant;
joth 2011/12/08 18:15:46 these two not needed? (_NPVariant & NPVariant)
Steve Block 2011/12/09 12:27:32 Done.
// This class handles injecting Java objects into a single RenderView. The Java
// object itself lives on the browser's WEBKIT thread, while a proxy object is
// created in the renderer. An instance of this class exists for each
// RenderViewHost.
class JavaBridgeDispatcherHost :
+ public RenderViewHostObserver,
public base::RefCountedThreadSafe<JavaBridgeDispatcherHost> {
joth 2011/12/08 18:15:46 nit: I *think* we tend to put ABCs before interfac
Steve Block 2011/12/09 12:27:32 Done.
public:
// We hold a weak pointer to the RenderViewhost. It must outlive this object.
@@ -35,15 +41,26 @@ class JavaBridgeDispatcherHost :
void AddNamedObject(const string16& name, NPObject* object);
void RemoveNamedObject(const string16& name);
+ // RenderViewHostObserver override:
+ // The IPC macros require this to be public.
+ virtual bool Send(IPC::Message* msg) OVERRIDE;
+
private:
friend class base::RefCountedThreadSafe<JavaBridgeDispatcherHost>;
~JavaBridgeDispatcherHost();
- void DoAddNamedObject(const string16& name, NPObject* object);
- void EnsureChannelIsSetUp();
+ // RenderViewHostObserver override:
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
+
+ // Message handlers
+ void OnGetChannelHandle(IPC::Message* reply_msg);
+
+ void GetChannelHandle(IPC::Message* reply_msg);
+ void CreateNPVariantParam(NPObject* object, NPVariant_Param* param);
+ void CreateObjectStub(NPObject* object, int route_id);
- RenderViewHost* render_view_host_;
- scoped_refptr<JavaBridgeChannelHost> channel_;
+ scoped_refptr<NPChannelBase> channel_;
+ bool is_renderer_initialized_;
DISALLOW_COPY_AND_ASSIGN(JavaBridgeDispatcherHost);
};

Powered by Google App Engine
This is Rietveld 408576698