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

Side by Side Diff: components/leveldb/env_mojo.cc

Issue 2838663002: Use correct task traits for mojo leveldb env background tasks. (Closed)
Patch Set: correct shutdown behavior Created 3 years, 8 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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,
418 base::TaskTraits()
419 .MayBlock()
420 .WithBaseSyncPrimitives()
421 .WithShutdownBehavior(base::TaskShutdownBehavior::BLOCK_SHUTDOWN),
422 base::Bind(function, arg));
417 } 423 }
418 424
419 void MojoEnv::StartThread(void (*function)(void* arg), void* arg) { 425 void MojoEnv::StartThread(void (*function)(void* arg), void* arg) {
420 new Thread(function, arg); // Will self-delete. 426 new Thread(function, arg); // Will self-delete.
421 } 427 }
422 428
423 } // namespace leveldb 429 } // namespace leveldb
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698