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

Unified Diff: content/browser/renderer_host/java/java_bridge_channel_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: Fix typo 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_channel_host.h
diff --git a/content/browser/renderer_host/java/java_bridge_channel_host.h b/content/browser/renderer_host/java/java_bridge_channel_host.h
index 424d42eec6fbc6013d40cb97392cc6a6bec610c6..40b746735c14ff128e5ba8febd63c80112a91473 100644
--- a/content/browser/renderer_host/java/java_bridge_channel_host.h
+++ b/content/browser/renderer_host/java/java_bridge_channel_host.h
@@ -8,10 +8,20 @@
#include "content/common/np_channel_base.h"
+// Threadsafe route ID generator.
joth 2011/12/07 14:49:09 could you expand this a little: - allows injection
Steve Block 2011/12/07 16:47:44 Done.
+class RouteIDGenerator : public base::RefCountedThreadSafe<RouteIDGenerator> {
+ public:
+ int GenerateRouteID() const;
+ private:
joth 2011/12/07 14:49:09 \n before
+ friend class base::RefCountedThreadSafe<RouteIDGenerator>;
+ ~RouteIDGenerator() {}
joth 2011/12/07 14:49:09 d'tor body always in .cc
+};
joth 2011/12/07 14:49:09 as this does not have any state (other than in a s
Steve Block 2011/12/07 16:47:44 The only state this captures is ensuring that all
+
class JavaBridgeChannelHost : public NPChannelBase {
public:
static JavaBridgeChannelHost* GetJavaBridgeChannelHost(
- int renderer_id, base::MessageLoopProxy*);
+ int renderer_id, base::MessageLoopProxy* ipc_message_loop,
joth 2011/12/07 14:49:09 one param per line in declarations.
+ RouteIDGenerator* route_id_generator);
// NPChannelBase implementation:
virtual int GenerateRouteID() OVERRIDE;
@@ -31,6 +41,11 @@ class JavaBridgeChannelHost : public NPChannelBase {
return new JavaBridgeChannelHost();
}
+ // Message handlers
+ void OnGenerateRouteID(int* route_id);
+
+ scoped_refptr<RouteIDGenerator> route_id_generator_;
+
DISALLOW_COPY_AND_ASSIGN(JavaBridgeChannelHost);
};

Powered by Google App Engine
This is Rietveld 408576698