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

Unified Diff: base/mac/bind_objc_block.h

Issue 1647803004: Move base to DEPS (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 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 | « base/mac/authorization_util.mm ('k') | base/mac/bind_objc_block_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/mac/bind_objc_block.h
diff --git a/base/mac/bind_objc_block.h b/base/mac/bind_objc_block.h
deleted file mode 100644
index c31f26e5a31f6347fc2459848f0d261a8e4c4bf4..0000000000000000000000000000000000000000
--- a/base/mac/bind_objc_block.h
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright (c) 2012 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 BASE_MAC_BIND_OBJC_BLOCK_H_
-#define BASE_MAC_BIND_OBJC_BLOCK_H_
-
-#include <Block.h>
-
-#include "base/bind.h"
-#include "base/callback_forward.h"
-#include "base/mac/scoped_block.h"
-
-// BindBlock builds a callback from an Objective-C block. Example usages:
-//
-// Closure closure = BindBlock(^{DoSomething();});
-//
-// Callback<int(void)> callback = BindBlock(^{return 42;});
-//
-// Callback<void(const std::string&, const std::string&)> callback =
-// BindBlock(^(const std::string& arg0, const std::string& arg1) {
-// ...
-// });
-//
-// These variadic templates will accommodate any number of arguments, however
-// the underlying templates in bind_internal.h and callback.h are limited to
-// seven total arguments, and the bound block itself is used as one of these
-// arguments, so functionally the templates are limited to binding blocks with
-// zero through six arguments.
-
-namespace base {
-
-namespace internal {
-
-// Helper function to run the block contained in the parameter.
-template<typename R, typename... Args>
-R RunBlock(base::mac::ScopedBlock<R(^)(Args...)> block, Args... args) {
- R(^extracted_block)(Args...) = block.get();
- return extracted_block(args...);
-}
-
-} // namespace internal
-
-// Construct a callback from an objective-C block with up to six arguments (see
-// note above).
-template<typename R, typename... Args>
-base::Callback<R(Args...)> BindBlock(R(^block)(Args...)) {
- return base::Bind(&base::internal::RunBlock<R, Args...>,
- base::mac::ScopedBlock<R(^)(Args...)>(Block_copy(block)));
-}
-
-} // namespace base
-
-#endif // BASE_MAC_BIND_OBJC_BLOCK_H_
« no previous file with comments | « base/mac/authorization_util.mm ('k') | base/mac/bind_objc_block_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698