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

Side by Side Diff: chrome/common/webmessageportchannel_impl.h

Issue 173193: Updating Worker.postMessage(), DOMWindow.postMessage(), and... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 CHROME_COMMON_WEBMESSAGEPORTCHANNEL_IMPL_H_ 5 #ifndef CHROME_COMMON_WEBMESSAGEPORTCHANNEL_IMPL_H_
6 #define CHROME_COMMON_WEBMESSAGEPORTCHANNEL_IMPL_H_ 6 #define CHROME_COMMON_WEBMESSAGEPORTCHANNEL_IMPL_H_
7 7
8 #include <queue> 8 #include <queue>
9 #include <vector>
9 10
10 #include "base/basictypes.h" 11 #include "base/basictypes.h"
11 #include "base/lock.h" 12 #include "base/lock.h"
12 #include "base/string16.h" 13 #include "base/string16.h"
13 #include "base/ref_counted.h" 14 #include "base/ref_counted.h"
14 #include "ipc/ipc_channel.h" 15 #include "ipc/ipc_channel.h"
15 #include "webkit/api/public/WebMessagePortChannel.h" 16 #include "webkit/api/public/WebMessagePortChannel.h"
16 17
17 // This is thread safe. 18 // This is thread safe.
18 class WebMessagePortChannelImpl 19 class WebMessagePortChannelImpl
(...skipping 11 matching lines...) Expand all
30 31
31 private: 32 private:
32 friend class base::RefCountedThreadSafe<WebMessagePortChannelImpl>; 33 friend class base::RefCountedThreadSafe<WebMessagePortChannelImpl>;
33 ~WebMessagePortChannelImpl(); 34 ~WebMessagePortChannelImpl();
34 35
35 // WebMessagePortChannel implementation. 36 // WebMessagePortChannel implementation.
36 virtual void setClient(WebKit::WebMessagePortChannelClient* client); 37 virtual void setClient(WebKit::WebMessagePortChannelClient* client);
37 virtual void destroy(); 38 virtual void destroy();
38 virtual void entangle(WebKit::WebMessagePortChannel* channel); 39 virtual void entangle(WebKit::WebMessagePortChannel* channel);
39 virtual void postMessage(const WebKit::WebString& message, 40 virtual void postMessage(const WebKit::WebString& message,
40 WebKit::WebMessagePortChannel* channel); 41 WebKit::WebMessagePortChannelArray* channels);
41 virtual bool tryGetMessage(WebKit::WebString* message, 42 virtual bool tryGetMessage(WebKit::WebString* message,
42 WebKit::WebMessagePortChannel** channel); 43 WebKit::WebMessagePortChannelArray& channels);
43 44
44 void Init(); 45 void Init();
45 void Entangle(scoped_refptr<WebMessagePortChannelImpl> channel); 46 void Entangle(scoped_refptr<WebMessagePortChannelImpl> channel);
46 void Send(IPC::Message* message); 47 void Send(IPC::Message* message);
47 48
48 // IPC::Channel::Listener implementation. 49 // IPC::Channel::Listener implementation.
49 virtual void OnMessageReceived(const IPC::Message& message); 50 virtual void OnMessageReceived(const IPC::Message& message);
50 51
51 void OnMessage(const string16& message, 52 void OnMessage(const string16& message,
52 int sent_message_port_id, 53 const std::vector<int>& sent_message_port_ids,
53 int new_routing_id); 54 const std::vector<int>& new_routing_ids);
54 void OnMessagedQueued(); 55 void OnMessagedQueued();
55 56
56 struct Message { 57 struct Message {
57 string16 message; 58 string16 message;
58 scoped_refptr<WebMessagePortChannelImpl> port; 59 std::vector<WebMessagePortChannelImpl*> ports;
59 }; 60 };
60 61
61 typedef std::queue<Message> MessageQueue; 62 typedef std::queue<Message> MessageQueue;
62 MessageQueue message_queue_; 63 MessageQueue message_queue_;
63 64
64 WebKit::WebMessagePortChannelClient* client_; 65 WebKit::WebMessagePortChannelClient* client_;
65 Lock lock_; // Locks access to above. 66 Lock lock_; // Locks access to above.
66 67
67 int route_id_; // The routing id for this object. 68 int route_id_; // The routing id for this object.
68 int message_port_id_; // A globally unique identifier for this message port. 69 int message_port_id_; // A globally unique identifier for this message port.
69 70
70 DISALLOW_COPY_AND_ASSIGN(WebMessagePortChannelImpl); 71 DISALLOW_COPY_AND_ASSIGN(WebMessagePortChannelImpl);
71 }; 72 };
72 73
73 #endif // CHROME_COMMON_WEBMESSAGEPORTCHANNEL_IMPL_H_ 74 #endif // CHROME_COMMON_WEBMESSAGEPORTCHANNEL_IMPL_H_
OLDNEW
« no previous file with comments | « chrome/browser/worker_host/worker_process_host.cc ('k') | chrome/common/webmessageportchannel_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698