| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 COMPONENTS_ARC_ARC_BRIDGE_HOST_IMPL_H_ | 5 #ifndef COMPONENTS_ARC_ARC_BRIDGE_HOST_IMPL_H_ |
| 6 #define COMPONENTS_ARC_ARC_BRIDGE_HOST_IMPL_H_ | 6 #define COMPONENTS_ARC_ARC_BRIDGE_HOST_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 void OnPolicyInstanceReady(mojom::PolicyInstancePtr policy_ptr) override; | 62 void OnPolicyInstanceReady(mojom::PolicyInstancePtr policy_ptr) override; |
| 63 void OnPowerInstanceReady(mojom::PowerInstancePtr power_ptr) override; | 63 void OnPowerInstanceReady(mojom::PowerInstancePtr power_ptr) override; |
| 64 void OnPrintInstanceReady(mojom::PrintInstancePtr print_ptr) override; | 64 void OnPrintInstanceReady(mojom::PrintInstancePtr print_ptr) override; |
| 65 void OnProcessInstanceReady(mojom::ProcessInstancePtr process_ptr) override; | 65 void OnProcessInstanceReady(mojom::ProcessInstancePtr process_ptr) override; |
| 66 void OnStorageManagerInstanceReady( | 66 void OnStorageManagerInstanceReady( |
| 67 mojom::StorageManagerInstancePtr storage_manager_ptr) override; | 67 mojom::StorageManagerInstancePtr storage_manager_ptr) override; |
| 68 void OnTtsInstanceReady(mojom::TtsInstancePtr tts_ptr) override; | 68 void OnTtsInstanceReady(mojom::TtsInstancePtr tts_ptr) override; |
| 69 void OnVideoInstanceReady(mojom::VideoInstancePtr video_ptr) override; | 69 void OnVideoInstanceReady(mojom::VideoInstancePtr video_ptr) override; |
| 70 void OnWallpaperInstanceReady( | 70 void OnWallpaperInstanceReady( |
| 71 mojom::WallpaperInstancePtr wallpaper_ptr) override; | 71 mojom::WallpaperInstancePtr wallpaper_ptr) override; |
| 72 void OnTraceInstanceReady( |
| 73 mojom::TraceInstancePtr trace_ptr) override; |
| 72 | 74 |
| 73 private: | 75 private: |
| 74 // Called when the bridge channel is closed. This typically only happens when | 76 // Called when the bridge channel is closed. This typically only happens when |
| 75 // the ARC instance crashes. | 77 // the ARC instance crashes. |
| 76 void OnClosed(); | 78 void OnClosed(); |
| 77 | 79 |
| 78 // The common implementation to handle ArcBridgeHost overrides. | 80 // The common implementation to handle ArcBridgeHost overrides. |
| 79 // |T| is a ARC Mojo Instance type. | 81 // |T| is a ARC Mojo Instance type. |
| 80 template <typename T> | 82 template <typename T> |
| 81 void OnInstanceReady(InstanceHolder<T>* holder, mojo::InterfacePtr<T> ptr); | 83 void OnInstanceReady(InstanceHolder<T>* holder, mojo::InterfacePtr<T> ptr); |
| 82 | 84 |
| 83 // Called if one of the established channels is closed. | 85 // Called if one of the established channels is closed. |
| 84 void OnChannelClosed(MojoChannel* channel); | 86 void OnChannelClosed(MojoChannel* channel); |
| 85 | 87 |
| 86 base::ThreadChecker thread_checker_; | 88 base::ThreadChecker thread_checker_; |
| 87 | 89 |
| 88 mojo::Binding<mojom::ArcBridgeHost> binding_; | 90 mojo::Binding<mojom::ArcBridgeHost> binding_; |
| 89 mojom::ArcBridgeInstancePtr instance_; | 91 mojom::ArcBridgeInstancePtr instance_; |
| 90 | 92 |
| 91 // Put as a last member to ensure that any callback tied to the elements | 93 // Put as a last member to ensure that any callback tied to the elements |
| 92 // is not invoked. | 94 // is not invoked. |
| 93 std::vector<std::unique_ptr<MojoChannel>> mojo_channels_; | 95 std::vector<std::unique_ptr<MojoChannel>> mojo_channels_; |
| 94 | 96 |
| 95 DISALLOW_COPY_AND_ASSIGN(ArcBridgeHostImpl); | 97 DISALLOW_COPY_AND_ASSIGN(ArcBridgeHostImpl); |
| 96 }; | 98 }; |
| 97 | 99 |
| 98 } // namespace arc | 100 } // namespace arc |
| 99 | 101 |
| 100 #endif // COMPONENTS_ARC_ARC_BRIDGE_HOST_IMPL_H_ | 102 #endif // COMPONENTS_ARC_ARC_BRIDGE_HOST_IMPL_H_ |
| OLD | NEW |