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

Side by Side Diff: base/mac/bind_objc_block.mm

Issue 10818034: Adding the possibility to build a closure from an ObjectiveC block. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Renaming the tests. Created 8 years, 4 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 unified diff | Download patch
« no previous file with comments | « base/mac/bind_objc_block.h ('k') | base/mac/bind_objc_block_unittest.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 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.
4
5 #import "base/mac/bind_objc_block.h"
6
7 #include "base/bind.h"
8 #include "base/memory/scoped_nsobject.h"
9
10 namespace {
11 // Run the block contained in the parameter.
12 void RunBlock(scoped_nsobject<id> block) {
13 void(^extracted_block)() = block.get();
14 extracted_block();
15 }
16 }
stuartmorgan 2012/07/25 12:45:26 Add a // namespace
noyau (Ping after 24h) 2012/07/25 12:56:34 Done.
17
18 namespace base {
19
20 base::Closure BindBlock(void(^block)()) {
21 return base::Bind(&RunBlock, scoped_nsobject<id>([block copy]));
22 }
23
24 } // namespace base
OLDNEW
« no previous file with comments | « base/mac/bind_objc_block.h ('k') | base/mac/bind_objc_block_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698