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

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

Issue 7477027: Support Transferable objects (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Update for interface changes. Created 9 years, 4 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
« no previous file with comments | « no previous file | content/common/webmessageportchannel_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_COMMON_WEBMESSAGEPORTCHANNEL_IMPL_H_ 5 #ifndef CONTENT_COMMON_WEBMESSAGEPORTCHANNEL_IMPL_H_
6 #define CONTENT_COMMON_WEBMESSAGEPORTCHANNEL_IMPL_H_ 6 #define CONTENT_COMMON_WEBMESSAGEPORTCHANNEL_IMPL_H_
7 #pragma once 7 #pragma once
8 8
9 #include <queue> 9 #include <queue>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/string16.h" 14 #include "base/string16.h"
15 #include "base/synchronization/lock.h" 15 #include "base/synchronization/lock.h"
16 #include "ipc/ipc_channel.h" 16 #include "ipc/ipc_channel.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMessagePortChannel .h" 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMessagePortChannel .h"
18 18
19 #ifndef WebTransferableReceipt_h
20 #ifndef STUB_WebTransferableReceipt_h
21 #define STUB_WebTransferableReceipt_h
22 namespace WebKit {
23 typedef WebMessagePortChannel WebTransferableReceipt;
24 typedef WebVector<WebTransferableReceipt*> WebTransferableReceiptArray;
25 } // namespace WebKit
26 #endif // STUB_WebTransferableReceipt_h
27 #endif // WebTransferableReceipt_h
28
19 // This is thread safe. 29 // This is thread safe.
20 class WebMessagePortChannelImpl 30 class WebMessagePortChannelImpl
21 : public WebKit::WebMessagePortChannel, 31 : public WebKit::WebMessagePortChannel,
22 public IPC::Channel::Listener, 32 public IPC::Channel::Listener,
23 public base::RefCountedThreadSafe<WebMessagePortChannelImpl> { 33 public base::RefCountedThreadSafe<WebMessagePortChannelImpl> {
24 public: 34 public:
25 WebMessagePortChannelImpl(); 35 WebMessagePortChannelImpl();
26 WebMessagePortChannelImpl(int route_id, int message_port_id); 36 WebMessagePortChannelImpl(int route_id, int message_port_id);
27 37
28 // Queues received and incoming messages until there are no more in-flight 38 // Queues received and incoming messages until there are no more in-flight
29 // messages, then sends all of them to the browser process. 39 // messages, then sends all of them to the browser process.
30 void QueueMessages(); 40 void QueueMessages();
31 int message_port_id() const { return message_port_id_; } 41 int message_port_id() const { return message_port_id_; }
32 42
33 private: 43 private:
34 friend class base::RefCountedThreadSafe<WebMessagePortChannelImpl>; 44 friend class base::RefCountedThreadSafe<WebMessagePortChannelImpl>;
35 virtual ~WebMessagePortChannelImpl(); 45 virtual ~WebMessagePortChannelImpl();
36 46
37 // WebMessagePortChannel implementation. 47 // WebMessagePortChannel implementation.
38 virtual void setClient(WebKit::WebMessagePortChannelClient* client); 48 virtual void setClient(WebKit::WebMessagePortChannelClient* client);
39 virtual void destroy(); 49 virtual void destroy();
40 virtual void entangle(WebKit::WebMessagePortChannel* channel); 50 virtual void entangle(WebKit::WebMessagePortChannel* channel);
41 virtual void postMessage(const WebKit::WebString& message, 51 virtual void postMessage(const WebKit::WebString& message,
42 WebKit::WebMessagePortChannelArray* channels); 52 WebKit::WebTransferableReceiptArray* receipts);
53 #ifndef WebTransferableReceipt_h
43 virtual bool tryGetMessage(WebKit::WebString* message, 54 virtual bool tryGetMessage(WebKit::WebString* message,
44 WebKit::WebMessagePortChannelArray& channels); 55 WebKit::WebTransferableReceiptArray& receipts);
56 #else
57 virtual bool tryGetMessageWithNewReceipts(
58 WebKit::WebString* message,
59 WebKit::WebTransferableReceiptArray& receipts);
60 #endif
45 61
46 void Init(); 62 void Init();
47 void Entangle(scoped_refptr<WebMessagePortChannelImpl> channel); 63 void Entangle(scoped_refptr<WebMessagePortChannelImpl> channel);
48 void Send(IPC::Message* message); 64 void Send(IPC::Message* message);
49 65
50 // IPC::Channel::Listener implementation. 66 // IPC::Channel::Listener implementation.
51 virtual bool OnMessageReceived(const IPC::Message& message); 67 virtual bool OnMessageReceived(const IPC::Message& message);
52 68
53 void OnMessage(const string16& message, 69 void OnMessage(const string16& message,
54 const std::vector<int>& sent_message_port_ids, 70 const std::vector<int>& sent_message_port_ids,
(...skipping 14 matching lines...) Expand all
69 WebKit::WebMessagePortChannelClient* client_; 85 WebKit::WebMessagePortChannelClient* client_;
70 base::Lock lock_; // Locks access to above. 86 base::Lock lock_; // Locks access to above.
71 87
72 int route_id_; // The routing id for this object. 88 int route_id_; // The routing id for this object.
73 int message_port_id_; // A globally unique identifier for this message port. 89 int message_port_id_; // A globally unique identifier for this message port.
74 90
75 DISALLOW_COPY_AND_ASSIGN(WebMessagePortChannelImpl); 91 DISALLOW_COPY_AND_ASSIGN(WebMessagePortChannelImpl);
76 }; 92 };
77 93
78 #endif // CONTENT_COMMON_WEBMESSAGEPORTCHANNEL_IMPL_H_ 94 #endif // CONTENT_COMMON_WEBMESSAGEPORTCHANNEL_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | content/common/webmessageportchannel_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698