OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_IO_HANDLER_H_ |
| 6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_IO_HANDLER_H_ |
| 7 |
| 8 #include "base/memory/weak_ptr.h" |
| 9 #include "content/browser/devtools/protocol/devtools_protocol_dispatcher.h" |
| 10 |
| 11 namespace base { |
| 12 class RefCountedString; |
| 13 } |
| 14 |
| 15 namespace content { |
| 16 namespace devtools { |
| 17 class DevToolsIOContext; |
| 18 |
| 19 namespace io { |
| 20 |
| 21 class Client; |
| 22 |
| 23 class IOHandler { |
| 24 public: |
| 25 using Response = DevToolsProtocolClient::Response; |
| 26 |
| 27 explicit IOHandler(DevToolsIOContext* io_context); |
| 28 ~IOHandler(); |
| 29 |
| 30 void SetClient(const scoped_ptr<Client>& client); |
| 31 |
| 32 // Protocol methods. |
| 33 Response Read(DevToolsCommandId command_id, const std::string& handle, |
| 34 const int* offset, const int* max_size); |
| 35 Response Close(const std::string& handle); |
| 36 |
| 37 private: |
| 38 void ReadComplete(DevToolsCommandId command_id, |
| 39 const scoped_refptr<base::RefCountedString>& data, int status); |
| 40 |
| 41 DevToolsIOContext* io_context_; |
| 42 base::WeakPtrFactory<IOHandler> weak_factory_; |
| 43 |
| 44 DISALLOW_COPY_AND_ASSIGN(IOHandler); |
| 45 }; |
| 46 |
| 47 } // namespace io |
| 48 } // namespace devtools |
| 49 } // namespace content |
| 50 |
| 51 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_TRACING_HANDLER_H_ |
OLD | NEW |