OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/sync/model_impl/model_type_store_impl.h" | 5 #include "components/sync/model_impl/model_type_store_impl.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 class TaskRunnerMap { | 61 class TaskRunnerMap { |
62 public: | 62 public: |
63 TaskRunnerMap() = default; | 63 TaskRunnerMap() = default; |
64 | 64 |
65 scoped_refptr<base::SequencedTaskRunner> GetOrCreateTaskRunner( | 65 scoped_refptr<base::SequencedTaskRunner> GetOrCreateTaskRunner( |
66 const std::string& path) { | 66 const std::string& path) { |
67 base::AutoLock scoped_lock(lock_); | 67 base::AutoLock scoped_lock(lock_); |
68 auto iter = task_runner_map_.find(path); | 68 auto iter = task_runner_map_.find(path); |
69 if (iter == task_runner_map_.end()) { | 69 if (iter == task_runner_map_.end()) { |
70 scoped_refptr<base::SequencedTaskRunner> task_runner = | 70 scoped_refptr<base::SequencedTaskRunner> task_runner = |
71 CreateSequencedTaskRunnerWithTraits( | 71 base::CreateSequencedTaskRunnerWithTraits( |
72 base::TaskTraits().MayBlock().WithShutdownBehavior( | 72 {base::MayBlock(), base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}); |
73 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN)); | |
74 task_runner_map_[path] = task_runner; | 73 task_runner_map_[path] = task_runner; |
75 return task_runner; | 74 return task_runner; |
76 } else { | 75 } else { |
77 return iter->second; | 76 return iter->second; |
78 } | 77 } |
79 } | 78 } |
80 | 79 |
81 private: | 80 private: |
82 mutable base::Lock lock_; | 81 mutable base::Lock lock_; |
83 std::map<std::string, scoped_refptr<base::SequencedTaskRunner>> | 82 std::map<std::string, scoped_refptr<base::SequencedTaskRunner>> |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 } | 414 } |
416 | 415 |
417 ModelTypeStoreImpl::WriteBatchImpl::WriteBatchImpl(ModelTypeStore* store) | 416 ModelTypeStoreImpl::WriteBatchImpl::WriteBatchImpl(ModelTypeStore* store) |
418 : WriteBatch(store) { | 417 : WriteBatch(store) { |
419 leveldb_write_batch_ = base::MakeUnique<leveldb::WriteBatch>(); | 418 leveldb_write_batch_ = base::MakeUnique<leveldb::WriteBatch>(); |
420 } | 419 } |
421 | 420 |
422 ModelTypeStoreImpl::WriteBatchImpl::~WriteBatchImpl() {} | 421 ModelTypeStoreImpl::WriteBatchImpl::~WriteBatchImpl() {} |
423 | 422 |
424 } // namespace syncer | 423 } // namespace syncer |
OLD | NEW |