OLD | NEW |
---|---|
(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 | |
OLD | NEW |