Chromium Code Reviews| Index: headless/lib/browser/headless_tab_socket_impl.h |
| diff --git a/headless/lib/browser/headless_tab_socket_impl.h b/headless/lib/browser/headless_tab_socket_impl.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d6e58dce6c4fe739b7ca422999c9fa65196ddd9b |
| --- /dev/null |
| +++ b/headless/lib/browser/headless_tab_socket_impl.h |
| @@ -0,0 +1,47 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef HEADLESS_LIB_BROWSER_HEADLESS_TAB_SOCKET_IMPL_H_ |
| +#define HEADLESS_LIB_BROWSER_HEADLESS_TAB_SOCKET_IMPL_H_ |
| + |
| +#include <list> |
| + |
| +#include "base/synchronization/lock.h" |
| +#include "headless/lib/tab_socket.mojom.h" |
| +#include "headless/public/headless_tab_socket.h" |
| +#include "mojo/public/cpp/bindings/binding_set.h" |
| + |
| +namespace headless { |
| + |
| +class HeadlessTabSocketImpl : public HeadlessTabSocket, public TabSocket { |
| + public: |
| + HeadlessTabSocketImpl(); |
| + ~HeadlessTabSocketImpl() override; |
| + |
| + // HeadlessTabSocket implementation: |
| + void SendMessageToTab(const std::string& message) override; |
| + void SetListener(Listener* listener) override; |
| + |
| + // TabSocket implementation: |
| + void SendMessageToEmbedder(const std::string& message) override; |
| + void AwaitNextMessageFromEmbedder( |
| + const AwaitNextMessageFromEmbedderCallback& callback) override; |
| + |
| + void CreateMojoService(mojo::InterfaceRequest<TabSocket> request); |
| + |
| + private: |
| + mojo::BindingSet<TabSocket> mojo_bindings_; |
| + |
| + base::Lock lock_; // Protects everything below. |
| + AwaitNextMessageFromEmbedderCallback waiting_for_message_cb_; |
| + std::list<std::string> out_going_message_queue_; |
|
Sami
2017/04/12 14:18:45
nit: outgoing_message_queue_
alex clarke (OOO till 29th)
2017/04/12 15:47:46
Done.
|
| + std::list<std::string> incomming_message_queue_; |
|
Sami
2017/04/12 14:18:45
typo: incoming
alex clarke (OOO till 29th)
2017/04/12 15:47:46
Done.
|
| + Listener* listener_; // NOT OWNED |
| + |
| + DISALLOW_COPY_AND_ASSIGN(HeadlessTabSocketImpl); |
| +}; |
| + |
| +} // namespace headless |
| + |
| +#endif // HEADLESS_LIB_BROWSER_HEADLESS_TAB_SOCKET_IMPL_H_ |