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

Side by Side 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: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_BROWSER_RENDERER_HOST_JAVA_JAVA_BRIDGE_CHANNEL_HOST_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BRIDGE_CHANNEL_HOST_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BRIDGE_CHANNEL_HOST_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BRIDGE_CHANNEL_HOST_H_
7 #pragma once 7 #pragma once
8 8
9 #include "content/common/np_channel_base.h" 9 #include "content/common/np_channel_base.h"
10 10
11 class JavaBridgeChannelHost : public NPChannelBase { 11 class JavaBridgeChannelHost : public NPChannelBase {
12 public: 12 public:
13 static JavaBridgeChannelHost* GetJavaBridgeChannelHost( 13 static JavaBridgeChannelHost* GetJavaBridgeChannelHost(
14 int renderer_id, base::MessageLoopProxy*); 14 int renderer_id,
15 base::MessageLoopProxy* ipc_message_loop);
16
17 // A threadsafe function to generate a unique route ID. Used by the
18 // JavaBridgeDispatcherHost on the UI thread and this class on the WEBKIT
19 // thread.
20 static int ThreadsafeGenerateRouteID();
15 21
16 // NPChannelBase implementation: 22 // NPChannelBase implementation:
17 virtual int GenerateRouteID() OVERRIDE; 23 virtual int GenerateRouteID() OVERRIDE;
18 24
19 // NPChannelBase override: 25 // NPChannelBase override:
20 virtual bool Init(base::MessageLoopProxy* ipc_message_loop, 26 virtual bool Init(base::MessageLoopProxy* ipc_message_loop,
21 bool create_pipe_now, 27 bool create_pipe_now,
22 base::WaitableEvent* shutdown_event) OVERRIDE; 28 base::WaitableEvent* shutdown_event) OVERRIDE;
23 virtual bool Send(IPC::Message* msg) OVERRIDE; 29 virtual bool Send(IPC::Message* msg) OVERRIDE;
24 30
25 private: 31 private:
26 JavaBridgeChannelHost() {} 32 JavaBridgeChannelHost() {}
27 friend class base::RefCountedThreadSafe<JavaBridgeChannelHost>; 33 friend class base::RefCountedThreadSafe<JavaBridgeChannelHost>;
28 virtual ~JavaBridgeChannelHost() {} 34 virtual ~JavaBridgeChannelHost() {}
29 35
30 static NPChannelBase* ClassFactory() { 36 static NPChannelBase* ClassFactory() {
31 return new JavaBridgeChannelHost(); 37 return new JavaBridgeChannelHost();
32 } 38 }
33 39
40 // Message handlers
41 void OnGenerateRouteID(int* route_id);
42
34 DISALLOW_COPY_AND_ASSIGN(JavaBridgeChannelHost); 43 DISALLOW_COPY_AND_ASSIGN(JavaBridgeChannelHost);
35 }; 44 };
36 45
37 #endif // CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BRIDGE_CHANNEL_HOST_H_ 46 #endif // CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BRIDGE_CHANNEL_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698