Index: webkit/glue/plugins/pepper_transport.h |
=================================================================== |
--- webkit/glue/plugins/pepper_transport.h (revision 68979) |
+++ webkit/glue/plugins/pepper_transport.h (working copy) |
@@ -5,31 +5,92 @@ |
#ifndef WEBKIT_GLUE_PLUGINS_PEPPER_TRANSPORT_H_ |
#define WEBKIT_GLUE_PLUGINS_PEPPER_TRANSPORT_H_ |
+#include <list> |
+ |
#include "base/scoped_ptr.h" |
-#include "ppapi/c/pp_instance.h" |
-#include "webkit/glue/plugins/pepper_plugin_delegate.h" |
+#include "ppapi/c/dev/ppb_transport_dev.h" |
+#include "third_party/libjingle/source/talk/base/sigslot.h" |
+#include "third_party/libjingle/source/talk/p2p/base/candidate.h" |
#include "webkit/glue/plugins/pepper_resource.h" |
-struct PPB_Transport_Dev; |
+namespace talk_base { |
+class NetworkManager; |
+} |
+namespace cricket { |
+class HttpPortAllocator; |
+class P2PTransportChannel; |
+class TransportChannel; |
+class TransportChannelImpl; |
+} |
+ |
namespace pepper { |
brettw
2010/12/21 21:55:50
Sorry, you'll have to rebase this patch on the lat
|
-class Transport : public Resource { |
+class Transport : public Resource, public sigslot::has_slots<> { |
public: |
+ static const PPB_Transport_Dev* GetInterface(); |
+ |
explicit Transport(PluginModule* module); |
virtual ~Transport(); |
- static const PPB_Transport_Dev* GetInterface(); |
+ |
+ bool Init(const char* name, const char* proto); |
+ |
+ // Resource override. |
virtual Transport* AsTransport() { |
return this; |
} |
- bool Init(const char* name, |
- const char* proto); |
+ |
+ bool IsWritable() const; |
+ int32_t Connect(PP_CompletionCallback cb); |
+ int32_t GetNextAddress(PP_Var* address, PP_CompletionCallback cb); |
+ int32_t ReceiveRemoteAddress(PP_Var address); |
+ int32_t Recv(void* data, uint32_t len, PP_CompletionCallback cb); |
+ int32_t Send(const void* data, size_t len, PP_CompletionCallback cb); |
+ int32_t Close(); |
+ |
private: |
+ struct CompletionContext { |
+ explicit CompletionContext(PP_CompletionCallback cb) { |
brettw
2010/12/21 21:55:50
Can you unify this with the stuff in webkit/plugin
|
+ callback = cb; |
+ } |
+ void Callback(int32_t result) { |
+ PP_RunCompletionCallback(&callback, result); |
+ } |
+ PP_CompletionCallback callback; |
+ }; |
+ typedef CompletionContext ConnectContext; |
+ struct GetNextAddressContext : CompletionContext { |
+ GetNextAddressContext(PP_Var* a, PP_CompletionCallback cb) |
+ : CompletionContext(cb), address(a) { |
+ } |
+ PP_Var* address; |
+ }; |
+ struct RecvContext : CompletionContext { |
+ RecvContext(void* d, uint32_t l, PP_CompletionCallback cb) |
+ : CompletionContext(cb), data(d), len(l) { |
+ } |
+ void* data; |
+ uint32_t len; |
+ }; |
- DISALLOW_COPY_AND_ASSIGN(Transport); |
+ void OnRequestSignaling(); |
brettw
2010/12/21 21:55:50
Are these functions implementation of some interfa
|
+ void OnCandidateReady(cricket::TransportChannelImpl*, |
brettw
2010/12/21 21:55:50
Normally we would name all arguments here.
|
+ const cricket::Candidate& candidate); |
+ void OnWriteableState(cricket::TransportChannel*); |
+ void OnReadPacket(cricket::TransportChannel*, const char*, size_t); |
+ |
+ bool Serialize(const cricket::Candidate& candidate, PP_Var* address); |
+ bool Deserialize(PP_Var address, cricket::Candidate* candidate); |
+ |
+ scoped_ptr<talk_base::NetworkManager> network_manager_; |
+ scoped_ptr<cricket::HttpPortAllocator> allocator_; |
+ scoped_ptr<cricket::P2PTransportChannel> channel_; |
+ std::list<cricket::Candidate> local_candidates_; |
brettw
2010/12/21 21:55:50
Can you provide documentation for this member?
Th
|
+ scoped_ptr<ConnectContext> connect_cx_; |
+ scoped_ptr<GetNextAddressContext> next_address_cx_; |
+ scoped_ptr<RecvContext> recv_cx_; |
}; |
} // namespace pepper |
#endif // WEBKIT_GLUE_PLUGINS_PEPPER_TRANSPORT_H_ |
- |