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

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: Adding whitespace. Created 8 years, 5 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
12 // Run the block contained in the parameter.
13 void RunBlock(scoped_nsobject<id> block) {
14 void(^extracted_block)() = block.get();
15 extracted_block();
16 }
Mark Mentovai 2012/07/25 15:40:19 Won’t the scoped_nsobject<> destructor run here, d
stuartmorgan 2012/07/25 15:56:31 Bind is hard for mortals to understand, but AFAICT
17
18 } // namespace
19
20 namespace base {
21
22 base::Closure BindBlock(void(^block)()) {
23 return base::Bind(&RunBlock, scoped_nsobject<id>([block copy]));
24 }
25
26 } // 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