Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1106)

Unified Diff: mojo/public/cpp/bindings/callback.h

Issue 814543006: Move //mojo/{public, edk} underneath //third_party (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/cpp/bindings/binding.h ('k') | mojo/public/cpp/bindings/error_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/callback.h
diff --git a/mojo/public/cpp/bindings/callback.h b/mojo/public/cpp/bindings/callback.h
deleted file mode 100644
index d7bab1632fb87397c817123e4bdbe2e9a263a2de..0000000000000000000000000000000000000000
--- a/mojo/public/cpp/bindings/callback.h
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright 2014 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 MOJO_PUBLIC_CPP_BINDINGS_CALLBACK_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_CALLBACK_H_
-
-#include "mojo/public/cpp/bindings/lib/callback_internal.h"
-#include "mojo/public/cpp/bindings/lib/shared_ptr.h"
-#include "mojo/public/cpp/bindings/lib/template_util.h"
-
-namespace mojo {
-
-template <typename Sig>
-class Callback;
-
-template <typename... Args>
-class Callback<void(Args...)> {
- public:
- struct Runnable {
- virtual ~Runnable() {}
- virtual void Run(
- typename internal::Callback_ParamTraits<Args>::ForwardType...)
- const = 0;
- };
-
- Callback() {}
-
- // The Callback assumes ownership of |runnable|.
- explicit Callback(Runnable* runnable) : sink_(runnable) {}
-
- // Any class that is copy-constructable and has a compatible Run method may
- // be adapted to a Callback using this constructor.
- template <typename Sink>
- Callback(const Sink& sink)
- : sink_(new Adapter<Sink>(sink)) {}
-
- void Run(typename internal::Callback_ParamTraits<Args>::ForwardType... args)
- const {
- if (sink_.get())
- sink_->Run(internal::Forward(args)...);
- }
-
- bool is_null() const { return !sink_.get(); }
-
- void reset() { sink_.reset(); }
-
- private:
- template <typename Sink>
- struct Adapter : public Runnable {
- explicit Adapter(const Sink& sink) : sink(sink) {}
- virtual void Run(
- typename internal::Callback_ParamTraits<Args>::ForwardType... args)
- const override {
- sink.Run(internal::Forward(args)...);
- }
- Sink sink;
- };
-
- internal::SharedPtr<Runnable> sink_;
-};
-
-typedef Callback<void()> Closure;
-
-} // namespace mojo
-
-#endif // MOJO_PUBLIC_CPP_BINDINGS_CALLBACK_H_
« no previous file with comments | « mojo/public/cpp/bindings/binding.h ('k') | mojo/public/cpp/bindings/error_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698