| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/prefs/leveldb_pref_store.h" | 5 #include "chrome/browser/prefs/leveldb_pref_store.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/json/json_string_value_serializer.h" | 10 #include "base/json/json_string_value_serializer.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 if (error & IO_ERROR) | 42 if (error & IO_ERROR) |
| 43 return PersistentPrefStore::PREF_READ_ERROR_LEVELDB_IO; | 43 return PersistentPrefStore::PREF_READ_ERROR_LEVELDB_IO; |
| 44 if (error & OPENED) | 44 if (error & OPENED) |
| 45 return PersistentPrefStore::PREF_READ_ERROR_LEVELDB_CORRUPTION; | 45 return PersistentPrefStore::PREF_READ_ERROR_LEVELDB_CORRUPTION; |
| 46 return PersistentPrefStore::PREF_READ_ERROR_LEVELDB_CORRUPTION_READ_ONLY; | 46 return PersistentPrefStore::PREF_READ_ERROR_LEVELDB_CORRUPTION_READ_ONLY; |
| 47 } | 47 } |
| 48 | 48 |
| 49 } // namespace | 49 } // namespace |
| 50 | 50 |
| 51 struct LevelDBPrefStore::ReadingResults { | 51 struct LevelDBPrefStore::ReadingResults { |
| 52 ReadingResults() : error(0) {} | 52 ReadingResults() : no_dir(true), error(0) {} |
| 53 bool no_dir; | 53 bool no_dir; |
| 54 scoped_ptr<leveldb::DB> db; | 54 scoped_ptr<leveldb::DB> db; |
| 55 scoped_ptr<PrefValueMap> value_map; | 55 scoped_ptr<PrefValueMap> value_map; |
| 56 int error; | 56 int error; |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 // An instance of this class is created on the UI thread but is used | 59 // An instance of this class is created on the UI thread but is used |
| 60 // exclusively on the FILE thread. | 60 // exclusively on the FILE thread. |
| 61 class LevelDBPrefStore::FileThreadSerializer { | 61 class LevelDBPrefStore::FileThreadSerializer { |
| 62 public: | 62 public: |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 } | 410 } |
| 411 | 411 |
| 412 // TODO(dgrogan): Call pref_filter_->FilterOnLoad | 412 // TODO(dgrogan): Call pref_filter_->FilterOnLoad |
| 413 | 413 |
| 414 if (error_delegate_.get() && read_error_ != PREF_READ_ERROR_NONE) | 414 if (error_delegate_.get() && read_error_ != PREF_READ_ERROR_NONE) |
| 415 error_delegate_->OnError(read_error_); | 415 error_delegate_->OnError(read_error_); |
| 416 | 416 |
| 417 FOR_EACH_OBSERVER( | 417 FOR_EACH_OBSERVER( |
| 418 PrefStore::Observer, observers_, OnInitializationCompleted(true)); | 418 PrefStore::Observer, observers_, OnInitializationCompleted(true)); |
| 419 } | 419 } |
| OLD | NEW |