OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 // The overwhelmingly common case is sending a single port, so handle that e
fficiently with an inline buffer of size 1. | 47 // The overwhelmingly common case is sending a single port, so handle that e
fficiently with an inline buffer of size 1. |
48 typedef Vector<RefPtr<MessagePort>, 1> MessagePortArray; | 48 typedef Vector<RefPtr<MessagePort>, 1> MessagePortArray; |
49 | 49 |
50 class MessagePort : public RefCounted<MessagePort>, public EventTarget { | 50 class MessagePort : public RefCounted<MessagePort>, public EventTarget { |
51 public: | 51 public: |
52 static PassRefPtr<MessagePort> create(ScriptExecutionContext& scriptExec
utionContext) { return adoptRef(new MessagePort(scriptExecutionContext)); } | 52 static PassRefPtr<MessagePort> create(ScriptExecutionContext& scriptExec
utionContext) { return adoptRef(new MessagePort(scriptExecutionContext)); } |
53 virtual ~MessagePort(); | 53 virtual ~MessagePort(); |
54 | 54 |
55 void postMessage(PassRefPtr<SerializedScriptValue> message, const Messag
ePortArray*, ExceptionCode&); | 55 void postMessage(PassRefPtr<SerializedScriptValue> message, const Messag
ePortArray*, ExceptionCode&); |
56 // Needed for Objective-C bindings (see bug 28774). | |
57 void postMessage(PassRefPtr<SerializedScriptValue> message, MessagePort*
, ExceptionCode&); | |
58 | 56 |
59 void start(); | 57 void start(); |
60 void close(); | 58 void close(); |
61 | 59 |
62 void entangle(PassOwnPtr<MessagePortChannel>); | 60 void entangle(PassOwnPtr<MessagePortChannel>); |
63 PassOwnPtr<MessagePortChannel> disentangle(); | 61 PassOwnPtr<MessagePortChannel> disentangle(); |
64 | 62 |
65 // Returns 0 if there is an exception, or if the passed-in array is 0/em
pty. | 63 // Returns 0 if there is an exception, or if the passed-in array is 0/em
pty. |
66 static PassOwnPtr<MessagePortChannelArray> disentanglePorts(const Messag
ePortArray*, ExceptionCode&); | 64 static PassOwnPtr<MessagePortChannelArray> disentanglePorts(const Messag
ePortArray*, ExceptionCode&); |
67 | 65 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 bool m_started; | 112 bool m_started; |
115 bool m_closed; | 113 bool m_closed; |
116 | 114 |
117 ScriptExecutionContext* m_scriptExecutionContext; | 115 ScriptExecutionContext* m_scriptExecutionContext; |
118 EventTargetData m_eventTargetData; | 116 EventTargetData m_eventTargetData; |
119 }; | 117 }; |
120 | 118 |
121 } // namespace WebCore | 119 } // namespace WebCore |
122 | 120 |
123 #endif // MessagePort_h | 121 #endif // MessagePort_h |
OLD | NEW |