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

Side by Side Diff: third_party/WebKit/public/platform/WebMessagePortChannel.h

Issue 2422793002: HTML MessagePort as mojo::MessagePipeHandle (Closed)
Patch Set: Add missing ScopedAsyncTaskScheduler instance for the new unit tests; required by a recent change t… Created 3 years, 10 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 15 matching lines...) Expand all
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef WebMessagePortChannel_h 31 #ifndef WebMessagePortChannel_h
32 #define WebMessagePortChannel_h 32 #define WebMessagePortChannel_h
33 33
34 #include "WebCommon.h" 34 #include "WebCommon.h"
35 #include "WebVector.h" 35 #include "WebVector.h"
36
37 #if INSIDE_BLINK
38 #include <memory> 36 #include <memory>
39 #endif
40 37
41 namespace blink { 38 namespace blink {
42 39
43 class WebMessagePortChannelClient; 40 class WebMessagePortChannelClient;
44 class WebString; 41 class WebString;
45 42
46 typedef WebVector<class WebMessagePortChannel*> WebMessagePortChannelArray; 43 using WebMessagePortChannelUniquePtr =
44 std::unique_ptr<class WebMessagePortChannel>;
45 using WebMessagePortChannelArray = WebVector<WebMessagePortChannelUniquePtr>;
47 46
48 // Provides an interface to a Message Port Channel implementation. The object 47 // Provides an interface to a Message Port Channel implementation.
49 // owns itself and is signalled that its not needed anymore with the destroy()
50 // call.
51 class WebMessagePortChannel { 48 class WebMessagePortChannel {
52 public: 49 public:
50 virtual ~WebMessagePortChannel() {}
53 virtual void setClient(WebMessagePortChannelClient*) = 0; 51 virtual void setClient(WebMessagePortChannelClient*) = 0;
54 virtual void destroy() = 0;
55 // Callee receives ownership of the passed vector. 52 // Callee receives ownership of the passed vector.
56 // FIXME: Blob refs should be passed to maintain ref counts. crbug.com/351753 53 // FIXME: Blob refs should be passed to maintain ref counts. crbug.com/351753
57 virtual void postMessage(const WebString&, WebMessagePortChannelArray*) = 0; 54 virtual void postMessage(const WebString&, WebMessagePortChannelArray) = 0;
58 virtual bool tryGetMessage(WebString*, WebMessagePortChannelArray&) = 0; 55 virtual bool tryGetMessage(WebString*, WebMessagePortChannelArray&) = 0;
59
60 protected:
61 ~WebMessagePortChannel() {}
62 }; 56 };
63 57
64 #if INSIDE_BLINK
65
66 struct WebMessagePortChannelDeleter {
67 void operator()(WebMessagePortChannel* channel) {
68 if (channel)
69 channel->destroy();
70 }
71 };
72
73 using WebMessagePortChannelUniquePtr =
74 std::unique_ptr<WebMessagePortChannel, WebMessagePortChannelDeleter>;
75
76 #endif // INSIDE_BLINK
77
78 } // namespace blink 58 } // namespace blink
79 59
80 #endif // WebMessagePortChannel_h 60 #endif // WebMessagePortChannel_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698