Index: services/media/factory_service/mojo_publisher.h |
diff --git a/services/media/factory_service/mojo_publisher.h b/services/media/factory_service/mojo_publisher.h |
deleted file mode 100644 |
index 0fb4e885e763f49f71438428484d173977ee4bf7..0000000000000000000000000000000000000000 |
--- a/services/media/factory_service/mojo_publisher.h |
+++ /dev/null |
@@ -1,65 +0,0 @@ |
-// Copyright 2016 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 SERVICES_MEDIA_FRAMEWORK_MOJO_PUBLISHER_H_ |
-#define SERVICES_MEDIA_FRAMEWORK_MOJO_PUBLISHER_H_ |
- |
-#include <functional> |
-#include <vector> |
- |
-namespace mojo { |
-namespace media { |
- |
-// Implements pull mode publishing (e.g. MediaPlayer::GetStatus). |
-template <typename TCallback> |
-class MojoPublisher { |
- public: |
- using CallbackRunner = std::function<void(const TCallback&, uint64_t)>; |
- |
- // Sets the callback runner. This method must be called before calling Get |
- // or Updated. The callback runner calls a single callback using current |
- // information. |
- void SetCallbackRunner(const CallbackRunner& callback_runner) { |
- DCHECK(callback_runner); |
- callback_runner_ = callback_runner; |
- } |
- |
- // Handles a get request from the client. This method should be called from |
- // the mojo 'get' method (e.g. MediaPlayer::GetStatus). |
- void Get(uint64_t version_last_seen, const TCallback& callback) { |
- DCHECK(callback_runner_); |
- |
- if (version_last_seen < version_) { |
- callback_runner_(callback, version_); |
- } else { |
- pending_callbacks_.push_back(callback); |
- } |
- } |
- |
- // Increments the version number and runs pending callbacks. This method |
- // should be called whenever the published information should be sent to |
- // subscribing clients. |
- void SendUpdates() { |
- DCHECK(callback_runner_); |
- |
- ++version_; |
- |
- std::vector<TCallback> pending_callbacks; |
- pending_callbacks_.swap(pending_callbacks); |
- |
- for (const TCallback& pending_callback : pending_callbacks) { |
- callback_runner_(pending_callback, version_); |
- } |
- } |
- |
- private: |
- uint64_t version_ = 1u; |
- std::vector<TCallback> pending_callbacks_; |
- CallbackRunner callback_runner_; |
-}; |
- |
-} // namespace media |
-} // namespace mojo |
- |
-#endif // SERVICES_MEDIA_FRAMEWORK_MOJO_MOJO_ALLOCATOR_H_ |