OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import "chrome/browser/mac/keystone_glue.h" | 5 #import "chrome/browser/mac/keystone_glue.h" |
6 | 6 |
7 #include <sys/mount.h> | 7 #include <sys/mount.h> |
8 #include <sys/param.h> | 8 #include <sys/param.h> |
9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
10 | 10 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 class PerformBridge : public base::RefCountedThreadSafe<PerformBridge> { | 64 class PerformBridge : public base::RefCountedThreadSafe<PerformBridge> { |
65 public: | 65 public: |
66 | 66 |
67 // Call |sel| on |target| with |arg| in a WorkerPool thread. | 67 // Call |sel| on |target| with |arg| in a WorkerPool thread. |
68 // |target| and |arg| are retained, |arg| may be |nil|. | 68 // |target| and |arg| are retained, |arg| may be |nil|. |
69 static void PostPerform(id target, SEL sel, id arg) { | 69 static void PostPerform(id target, SEL sel, id arg) { |
70 DCHECK(target); | 70 DCHECK(target); |
71 DCHECK(sel); | 71 DCHECK(sel); |
72 | 72 |
73 scoped_refptr<PerformBridge> op = new PerformBridge(target, sel, arg); | 73 scoped_refptr<PerformBridge> op = new PerformBridge(target, sel, arg); |
74 base::PostTaskWithTraits( | 74 base::PostTaskWithTraits(FROM_HERE, |
75 FROM_HERE, base::TaskTraits() | 75 {base::MayBlock(), base::TaskPriority::BACKGROUND, |
76 .MayBlock() | 76 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}, |
77 .WithPriority(base::TaskPriority::BACKGROUND) | 77 base::Bind(&PerformBridge::Run, op.get())); |
78 .WithShutdownBehavior( | |
79 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN), | |
80 base::Bind(&PerformBridge::Run, op.get())); | |
81 } | 78 } |
82 | 79 |
83 // Convenience for the no-argument case. | 80 // Convenience for the no-argument case. |
84 static void PostPerform(id target, SEL sel) { | 81 static void PostPerform(id target, SEL sel) { |
85 PostPerform(target, sel, nil); | 82 PostPerform(target, sel, nil); |
86 } | 83 } |
87 | 84 |
88 private: | 85 private: |
89 // Allow RefCountedThreadSafe<> to delete. | 86 // Allow RefCountedThreadSafe<> to delete. |
90 friend class base::RefCountedThreadSafe<PerformBridge>; | 87 friend class base::RefCountedThreadSafe<PerformBridge>; |
(...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1199 return [KeystoneGlue defaultKeystoneGlue] != nil; | 1196 return [KeystoneGlue defaultKeystoneGlue] != nil; |
1200 } | 1197 } |
1201 | 1198 |
1202 base::string16 CurrentlyInstalledVersion() { | 1199 base::string16 CurrentlyInstalledVersion() { |
1203 KeystoneGlue* keystoneGlue = [KeystoneGlue defaultKeystoneGlue]; | 1200 KeystoneGlue* keystoneGlue = [KeystoneGlue defaultKeystoneGlue]; |
1204 NSString* version = [keystoneGlue currentlyInstalledVersion]; | 1201 NSString* version = [keystoneGlue currentlyInstalledVersion]; |
1205 return base::SysNSStringToUTF16(version); | 1202 return base::SysNSStringToUTF16(version); |
1206 } | 1203 } |
1207 | 1204 |
1208 } // namespace keystone_glue | 1205 } // namespace keystone_glue |
OLD | NEW |