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

Side by Side Diff: base/time/time_mac.cc

Issue 1411523006: mac: Make Mach port scopers better ScopedGenerics (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Created 5 years, 2 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/sys_info_mac.cc ('k') | content/browser/browser_io_surface_manager_mac.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "base/time/time.h" 5 #include "base/time/time.h"
6 6
7 #include <CoreFoundation/CFDate.h> 7 #include <CoreFoundation/CFDate.h>
8 #include <CoreFoundation/CFTimeZone.h> 8 #include <CoreFoundation/CFTimeZone.h>
9 #include <mach/mach.h> 9 #include <mach/mach.h>
10 #include <mach/mach_time.h> 10 #include <mach/mach_time.h>
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 base::mac::ScopedMachSendRight thread(mach_thread_self()); 76 base::mac::ScopedMachSendRight thread(mach_thread_self());
77 mach_msg_type_number_t thread_info_count = THREAD_BASIC_INFO_COUNT; 77 mach_msg_type_number_t thread_info_count = THREAD_BASIC_INFO_COUNT;
78 thread_basic_info_data_t thread_info_data; 78 thread_basic_info_data_t thread_info_data;
79 79
80 if (thread.get() == MACH_PORT_NULL) { 80 if (thread.get() == MACH_PORT_NULL) {
81 DLOG(ERROR) << "Failed to get mach_thread_self()"; 81 DLOG(ERROR) << "Failed to get mach_thread_self()";
82 return 0; 82 return 0;
83 } 83 }
84 84
85 kern_return_t kr = thread_info( 85 kern_return_t kr = thread_info(
86 thread, 86 thread.get(),
87 THREAD_BASIC_INFO, 87 THREAD_BASIC_INFO,
88 reinterpret_cast<thread_info_t>(&thread_info_data), 88 reinterpret_cast<thread_info_t>(&thread_info_data),
89 &thread_info_count); 89 &thread_info_count);
90 MACH_DCHECK(kr == KERN_SUCCESS, kr) << "thread_info"; 90 MACH_DCHECK(kr == KERN_SUCCESS, kr) << "thread_info";
91 91
92 base::CheckedNumeric<int64_t> absolute_micros( 92 base::CheckedNumeric<int64_t> absolute_micros(
93 thread_info_data.user_time.seconds); 93 thread_info_data.user_time.seconds);
94 absolute_micros *= base::Time::kMicrosecondsPerSecond; 94 absolute_micros *= base::Time::kMicrosecondsPerSecond;
95 absolute_micros += thread_info_data.user_time.microseconds; 95 absolute_micros += thread_info_data.user_time.microseconds;
96 return absolute_micros.ValueOrDie(); 96 return absolute_micros.ValueOrDie();
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 ThreadTicks ThreadTicks::Now() { 230 ThreadTicks ThreadTicks::Now() {
231 return ThreadTicks(ComputeThreadTicks()); 231 return ThreadTicks(ComputeThreadTicks());
232 } 232 }
233 233
234 // static 234 // static
235 TraceTicks TraceTicks::Now() { 235 TraceTicks TraceTicks::Now() {
236 return TraceTicks(ComputeCurrentTicks()); 236 return TraceTicks(ComputeCurrentTicks());
237 } 237 }
238 238
239 } // namespace base 239 } // namespace base
OLDNEW
« no previous file with comments | « base/sys_info_mac.cc ('k') | content/browser/browser_io_surface_manager_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698