Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/leveldb/env_mojo.h" | 5 #include "components/leveldb/env_mojo.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 406 uint64_t MojoEnv::NowMicros() { | 406 uint64_t MojoEnv::NowMicros() { |
| 407 return base::TimeTicks::Now().ToInternalValue(); | 407 return base::TimeTicks::Now().ToInternalValue(); |
| 408 } | 408 } |
| 409 | 409 |
| 410 void MojoEnv::SleepForMicroseconds(int micros) { | 410 void MojoEnv::SleepForMicroseconds(int micros) { |
| 411 // Round up to the next millisecond. | 411 // Round up to the next millisecond. |
| 412 base::PlatformThread::Sleep(base::TimeDelta::FromMicroseconds(micros)); | 412 base::PlatformThread::Sleep(base::TimeDelta::FromMicroseconds(micros)); |
| 413 } | 413 } |
| 414 | 414 |
| 415 void MojoEnv::Schedule(void (*function)(void* arg), void* arg) { | 415 void MojoEnv::Schedule(void (*function)(void* arg), void* arg) { |
| 416 base::PostTask(FROM_HERE, base::Bind(function, arg)); | 416 base::PostTaskWithTraits( |
| 417 FROM_HERE, base::TaskTraits().MayBlock().WithBaseSyncPrimitives(), | |
|
michaeln
2017/04/24 20:54:17
lgtm - Do you know if these tasks are skipped whet
Marijn Kruisselbrink
2017/04/24 21:05:23
Good point, yes, I believe destructing the leveldb
| |
| 418 base::Bind(function, arg)); | |
| 417 } | 419 } |
| 418 | 420 |
| 419 void MojoEnv::StartThread(void (*function)(void* arg), void* arg) { | 421 void MojoEnv::StartThread(void (*function)(void* arg), void* arg) { |
| 420 new Thread(function, arg); // Will self-delete. | 422 new Thread(function, arg); // Will self-delete. |
| 421 } | 423 } |
| 422 | 424 |
| 423 } // namespace leveldb | 425 } // namespace leveldb |
| OLD | NEW |