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

Side by Side Diff: webkit/plugins/ppapi/ppb_websocket_impl.h

Issue 9026007: WebSocket Pepper API: WebArrayBuffer support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove obsoleted WebData support Created 8 years, 11 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 WEBKIT_PLUGINS_PPAPI_PPB_WEBSOCKET_IMPL_H_ 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_WEBSOCKET_IMPL_H_
6 #define WEBKIT_PLUGINS_PPAPI_PPB_WEBSOCKET_IMPL_H_ 6 #define WEBKIT_PLUGINS_PPAPI_PPB_WEBSOCKET_IMPL_H_
7 7
8 #include <queue> 8 #include <queue>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "ppapi/shared_impl/resource.h" 11 #include "ppapi/shared_impl/resource.h"
12 #include "ppapi/shared_impl/tracked_callback.h" 12 #include "ppapi/shared_impl/tracked_callback.h"
13 #include "ppapi/thunk/ppb_websocket_api.h" 13 #include "ppapi/thunk/ppb_websocket_api.h"
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSocketClient.h" 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSocketClient.h"
15 15
16 namespace ppapi { 16 namespace ppapi {
17 class StringVar; 17 class StringVar;
18 class Var;
18 } 19 }
19 20
20 namespace WebKit { 21 namespace WebKit {
21 class WebSocket; 22 class WebSocket;
22 } 23 }
23 24
24 namespace webkit { 25 namespace webkit {
25 namespace ppapi { 26 namespace ppapi {
26 27
27 // All implementation is in this class for now. We should move some common 28 // All implementation is in this class for now. We should move some common
(...skipping 29 matching lines...) Expand all
57 virtual PP_Var GetProtocol() OVERRIDE; 58 virtual PP_Var GetProtocol() OVERRIDE;
58 virtual PP_WebSocketReadyState_Dev GetReadyState() OVERRIDE; 59 virtual PP_WebSocketReadyState_Dev GetReadyState() OVERRIDE;
59 virtual PP_Var GetURL() OVERRIDE; 60 virtual PP_Var GetURL() OVERRIDE;
60 virtual PP_Bool SetBinaryType( 61 virtual PP_Bool SetBinaryType(
61 PP_WebSocketBinaryType_Dev binary_type) OVERRIDE; 62 PP_WebSocketBinaryType_Dev binary_type) OVERRIDE;
62 virtual PP_WebSocketBinaryType_Dev GetBinaryType() OVERRIDE; 63 virtual PP_WebSocketBinaryType_Dev GetBinaryType() OVERRIDE;
63 64
64 // WebSocketClient implementation. 65 // WebSocketClient implementation.
65 virtual void didConnect(); 66 virtual void didConnect();
66 virtual void didReceiveMessage(const WebKit::WebString& message); 67 virtual void didReceiveMessage(const WebKit::WebString& message);
67 virtual void didReceiveBinaryData(const WebKit::WebData& binaryData); 68 virtual void didReceiveArrayBuffer(const WebKit::WebArrayBuffer& binaryData);
68 virtual void didReceiveMessageError(); 69 virtual void didReceiveMessageError();
69 virtual void didUpdateBufferedAmount(unsigned long buffered_amount); 70 virtual void didUpdateBufferedAmount(unsigned long buffered_amount);
70 virtual void didStartClosingHandshake(); 71 virtual void didStartClosingHandshake();
71 virtual void didClose(unsigned long unhandled_buffered_amount, 72 virtual void didClose(unsigned long unhandled_buffered_amount,
72 ClosingHandshakeCompletionStatus status, 73 ClosingHandshakeCompletionStatus status,
73 unsigned short code, 74 unsigned short code,
74 const WebKit::WebString& reason); 75 const WebKit::WebString& reason);
75 private: 76 private:
76 int32_t DoReceive(); 77 int32_t DoReceive();
77 78
78 scoped_ptr<WebKit::WebSocket> websocket_; 79 scoped_ptr<WebKit::WebSocket> websocket_;
79 PP_WebSocketReadyState_Dev state_; 80 PP_WebSocketReadyState_Dev state_;
80 PP_WebSocketBinaryType_Dev binary_type_; 81 PP_WebSocketBinaryType_Dev binary_type_;
81 bool error_was_received_; 82 bool error_was_received_;
82 83
83 scoped_refptr< ::ppapi::TrackedCallback> connect_callback_; 84 scoped_refptr< ::ppapi::TrackedCallback> connect_callback_;
84 85
85 scoped_refptr< ::ppapi::TrackedCallback> receive_callback_; 86 scoped_refptr< ::ppapi::TrackedCallback> receive_callback_;
86 PP_Var* receive_callback_var_; 87 PP_Var* receive_callback_var_;
87 bool wait_for_receive_; 88 bool wait_for_receive_;
88 // TODO(toyoshim): Use std::queue<Var> when it supports binary. 89 std::queue< ::ppapi::Var*> received_messages_;
89 std::queue<PP_Var> received_messages_;
90 90
91 scoped_refptr< ::ppapi::TrackedCallback> close_callback_; 91 scoped_refptr< ::ppapi::TrackedCallback> close_callback_;
92 uint16_t close_code_; 92 uint16_t close_code_;
93 scoped_refptr< ::ppapi::StringVar> close_reason_; 93 scoped_refptr< ::ppapi::StringVar> close_reason_;
94 PP_Bool close_was_clean_; 94 PP_Bool close_was_clean_;
95 95
96 scoped_refptr< ::ppapi::StringVar> empty_string_; 96 scoped_refptr< ::ppapi::StringVar> empty_string_;
97 scoped_refptr< ::ppapi::StringVar> extensions_; 97 scoped_refptr< ::ppapi::StringVar> extensions_;
98 scoped_refptr< ::ppapi::StringVar> url_; 98 scoped_refptr< ::ppapi::StringVar> url_;
99 99
100 uint64_t buffered_amount_; 100 uint64_t buffered_amount_;
101 uint64_t buffered_amount_after_close_; 101 uint64_t buffered_amount_after_close_;
102 102
103 DISALLOW_COPY_AND_ASSIGN(PPB_WebSocket_Impl); 103 DISALLOW_COPY_AND_ASSIGN(PPB_WebSocket_Impl);
104 }; 104 };
105 105
106 } // namespace ppapi 106 } // namespace ppapi
107 } // namespace webkit 107 } // namespace webkit
108 108
109 #endif // WEBKIT_PLUGINS_PPAPI_PPB_WEBSOCKET_IMPL_H_ 109 #endif // WEBKIT_PLUGINS_PPAPI_PPB_WEBSOCKET_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | webkit/plugins/ppapi/ppb_websocket_impl.cc » ('j') | webkit/plugins/ppapi/ppb_websocket_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698