1 // Copyright 2013 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.
5 #ifndef TOOLS_ANDROID_FORWARDER2_FORWARDERS_MANAGER_H_
6 #define TOOLS_ANDROID_FORWARDER2_FORWARDERS_MANAGER_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/scoped_vector.h"
10 #include "base/threading/thread.h"
11 #include "tools/android/forwarder2/pipe_notifier.h"
13 namespace forwarder2 {
18 // Creates, owns and notifies Forwarder instances on its own internal thread.
19 class ForwardersManager {
23 // Must be called on the thread the constructor was called on.
26 // Can be called on any thread.
27 void CreateAndStartNewForwarder(scoped_ptr<Socket> socket1,
28 scoped_ptr<Socket> socket2);
31 void CreateNewForwarderOnInternalThread(scoped_ptr<Socket> socket1,
32 scoped_ptr<Socket> socket2);
34 void WaitForEventsOnInternalThreadSoon();
35 void WaitForEventsOnInternalThread();
37 ScopedVector<Forwarder> forwarders_;
38 PipeNotifier deletion_notifier_;
39 PipeNotifier wakeup_notifier_;
43 } // namespace forwarder2
45 #endif // TOOLS_ANDROID_FORWARDER2_FORWARDERS_MANAGER_H_