| 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::PostTaskWithTraits( | 416 base::PostTaskWithTraits(FROM_HERE, |
| 417 FROM_HERE, | 417 {base::MayBlock(), base::WithBaseSyncPrimitives(), |
| 418 base::TaskTraits() | 418 base::TaskShutdownBehavior::BLOCK_SHUTDOWN}, |
| 419 .MayBlock() | 419 base::Bind(function, arg)); |
| 420 .WithBaseSyncPrimitives() | |
| 421 .WithShutdownBehavior(base::TaskShutdownBehavior::BLOCK_SHUTDOWN), | |
| 422 base::Bind(function, arg)); | |
| 423 } | 420 } |
| 424 | 421 |
| 425 void MojoEnv::StartThread(void (*function)(void* arg), void* arg) { | 422 void MojoEnv::StartThread(void (*function)(void* arg), void* arg) { |
| 426 new Thread(function, arg); // Will self-delete. | 423 new Thread(function, arg); // Will self-delete. |
| 427 } | 424 } |
| 428 | 425 |
| 429 } // namespace leveldb | 426 } // namespace leveldb |
| OLD | NEW |