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

Side by Side Diff: mojo/services/network/web_socket_impl.h

Issue 1139673003: Make Mandoline shut down cleanly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 7 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 MOJO_SERVICES_NETWORK_WEB_SOCKET_IMPL_H_ 5 #ifndef MOJO_SERVICES_NETWORK_WEB_SOCKET_IMPL_H_
6 #define MOJO_SERVICES_NETWORK_WEB_SOCKET_IMPL_H_ 6 #define MOJO_SERVICES_NETWORK_WEB_SOCKET_IMPL_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "mojo/application/app_lifetime_helper.h"
9 #include "mojo/services/network/public/interfaces/web_socket.mojom.h" 10 #include "mojo/services/network/public/interfaces/web_socket.mojom.h"
10 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_impl.h" 11 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_impl.h"
11 12
12 namespace net { 13 namespace net {
13 class WebSocketChannel; 14 class WebSocketChannel;
14 } // namespace net 15 } // namespace net
15 16
16 namespace mojo { 17 namespace mojo {
17 class NetworkContext; 18 class NetworkContext;
18 class WebSocketReadQueue; 19 class WebSocketReadQueue;
19 20
20 // Forms a bridge between the WebSocket mojo interface and the net::WebSocket 21 // Forms a bridge between the WebSocket mojo interface and the net::WebSocket
21 // implementation. 22 // implementation.
22 class WebSocketImpl : public InterfaceImpl<WebSocket> { 23 class WebSocketImpl : public InterfaceImpl<WebSocket> {
23 public: 24 public:
24 explicit WebSocketImpl(NetworkContext* context); 25 WebSocketImpl(NetworkContext* context,
26 scoped_ptr<mojo::AppRefCount> app_refcount);
25 ~WebSocketImpl() override; 27 ~WebSocketImpl() override;
26 28
27 private: 29 private:
28 // WebSocket methods: 30 // WebSocket methods:
29 void Connect(const String& url, 31 void Connect(const String& url,
30 Array<String> protocols, 32 Array<String> protocols,
31 const String& origin, 33 const String& origin,
32 ScopedDataPipeConsumerHandle send_stream, 34 ScopedDataPipeConsumerHandle send_stream,
33 WebSocketClientPtr client) override; 35 WebSocketClientPtr client) override;
34 void Send(bool fin, WebSocket::MessageType type, uint32_t num_bytes) override; 36 void Send(bool fin, WebSocket::MessageType type, uint32_t num_bytes) override;
35 void FlowControl(int64_t quota) override; 37 void FlowControl(int64_t quota) override;
36 void Close(uint16_t code, const String& reason) override; 38 void Close(uint16_t code, const String& reason) override;
37 39
38 // Called with the data to send once it has been read from |send_stream_|. 40 // Called with the data to send once it has been read from |send_stream_|.
39 void DidReadFromSendStream(bool fin, 41 void DidReadFromSendStream(bool fin,
40 WebSocket::MessageType type, 42 WebSocket::MessageType type,
41 uint32_t num_bytes, 43 uint32_t num_bytes,
42 const char* data); 44 const char* data);
43 45
44 // The channel we use to send events to the network. 46 // The channel we use to send events to the network.
45 scoped_ptr<net::WebSocketChannel> channel_; 47 scoped_ptr<net::WebSocketChannel> channel_;
46 ScopedDataPipeConsumerHandle send_stream_; 48 ScopedDataPipeConsumerHandle send_stream_;
47 scoped_ptr<WebSocketReadQueue> read_queue_; 49 scoped_ptr<WebSocketReadQueue> read_queue_;
48 NetworkContext* context_; 50 NetworkContext* context_;
51 scoped_ptr<mojo::AppRefCount> app_refcount_;
49 }; 52 };
50 53
51 } // namespace mojo 54 } // namespace mojo
52 55
53 #endif // MOJO_SERVICES_NETWORK_WEB_SOCKET_IMPL_H_ 56 #endif // MOJO_SERVICES_NETWORK_WEB_SOCKET_IMPL_H_
OLDNEW
« no previous file with comments | « mojo/services/network/url_loader_impl_apptest.cc ('k') | mojo/services/network/web_socket_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698