| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 CONTENT_BROWSER_DEVTOOLS_PROTOCOL_IO_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_IO_HANDLER_H_ |
| 6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_IO_HANDLER_H_ | 6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_IO_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "content/browser/devtools/protocol/devtools_domain_handler.h" |
| 10 #include "content/browser/devtools/protocol/io.h" | 11 #include "content/browser/devtools/protocol/io.h" |
| 11 | 12 |
| 12 namespace base { | 13 namespace base { |
| 13 class RefCountedString; | 14 class RefCountedString; |
| 14 } | 15 } |
| 15 | 16 |
| 16 namespace content { | 17 namespace content { |
| 17 class DevToolsIOContext; | 18 class DevToolsIOContext; |
| 18 | 19 |
| 19 namespace protocol { | 20 namespace protocol { |
| 20 | 21 |
| 21 class IOHandler : public IO::Backend { | 22 class IOHandler : public DevToolsDomainHandler, |
| 23 public IO::Backend { |
| 22 public: | 24 public: |
| 23 explicit IOHandler(DevToolsIOContext* io_context); | 25 explicit IOHandler(DevToolsIOContext* io_context); |
| 24 ~IOHandler() override; | 26 ~IOHandler() override; |
| 25 | 27 |
| 26 void Wire(UberDispatcher*); | 28 void Wire(UberDispatcher* dispatcher) override; |
| 27 Response Disable() override; | |
| 28 | 29 |
| 29 // Protocol methods. | 30 // Protocol methods. |
| 30 void Read( | 31 void Read( |
| 31 const std::string& handle, | 32 const std::string& handle, |
| 32 Maybe<int> offset, | 33 Maybe<int> offset, |
| 33 Maybe<int> max_size, | 34 Maybe<int> max_size, |
| 34 std::unique_ptr<ReadCallback> callback) override; | 35 std::unique_ptr<ReadCallback> callback) override; |
| 35 Response Close(const std::string& handle) override; | 36 Response Close(const std::string& handle) override; |
| 36 | 37 |
| 37 private: | 38 private: |
| 38 void ReadComplete(std::unique_ptr<ReadCallback> callback, | 39 void ReadComplete(std::unique_ptr<ReadCallback> callback, |
| 39 const scoped_refptr<base::RefCountedString>& data, int status); | 40 const scoped_refptr<base::RefCountedString>& data, int status); |
| 40 | 41 |
| 41 std::unique_ptr<IO::Frontend> frontend_; | 42 std::unique_ptr<IO::Frontend> frontend_; |
| 42 DevToolsIOContext* io_context_; | 43 DevToolsIOContext* io_context_; |
| 43 base::WeakPtrFactory<IOHandler> weak_factory_; | 44 base::WeakPtrFactory<IOHandler> weak_factory_; |
| 44 | 45 |
| 45 DISALLOW_COPY_AND_ASSIGN(IOHandler); | 46 DISALLOW_COPY_AND_ASSIGN(IOHandler); |
| 46 }; | 47 }; |
| 47 | 48 |
| 48 } // namespace protocol | 49 } // namespace protocol |
| 49 } // namespace content | 50 } // namespace content |
| 50 | 51 |
| 51 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_TRACING_HANDLER_H_ | 52 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_TRACING_HANDLER_H_ |
| OLD | NEW |