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

Side by Side Diff: chrome/common/json_pref_store.h

Issue 7714038: Reverts debugging code added in hopes of tracking crash. This also (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/views/chrome_views_delegate.cc ('k') | chrome/common/json_pref_store.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef CHROME_COMMON_JSON_PREF_STORE_H_ 5 #ifndef CHROME_COMMON_JSON_PREF_STORE_H_
6 #define CHROME_COMMON_JSON_PREF_STORE_H_ 6 #define CHROME_COMMON_JSON_PREF_STORE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 24 matching lines...) Expand all
35 35
36 // PrefStore overrides: 36 // PrefStore overrides:
37 virtual ReadResult GetValue(const std::string& key, 37 virtual ReadResult GetValue(const std::string& key,
38 const base::Value** result) const; 38 const base::Value** result) const;
39 virtual void AddObserver(PrefStore::Observer* observer); 39 virtual void AddObserver(PrefStore::Observer* observer);
40 virtual void RemoveObserver(PrefStore::Observer* observer); 40 virtual void RemoveObserver(PrefStore::Observer* observer);
41 virtual bool IsInitializationComplete() const; 41 virtual bool IsInitializationComplete() const;
42 42
43 // PersistentPrefStore overrides: 43 // PersistentPrefStore overrides:
44 virtual ReadResult GetMutableValue(const std::string& key, 44 virtual ReadResult GetMutableValue(const std::string& key,
45 base::Value** result) OVERRIDE; 45 base::Value** result);
46 virtual void SetValue(const std::string& key, base::Value* value) OVERRIDE; 46 virtual void SetValue(const std::string& key, base::Value* value);
47 virtual void SetValueSilently(const std::string& key, 47 virtual void SetValueSilently(const std::string& key, base::Value* value);
48 base::Value* value) OVERRIDE; 48 virtual void RemoveValue(const std::string& key);
49 virtual void RemoveValue(const std::string& key) OVERRIDE; 49 virtual bool ReadOnly() const;
50 virtual bool ReadOnly() const OVERRIDE; 50 virtual PrefReadError ReadPrefs();
51 virtual PrefReadError ReadPrefs() OVERRIDE; 51 virtual void ReadPrefsAsync(ReadErrorDelegate* error_delegate);
52 virtual void ReadPrefsAsync(ReadErrorDelegate* error_delegate) OVERRIDE; 52 virtual bool WritePrefs();
53 virtual bool WritePrefs() OVERRIDE; 53 virtual void ScheduleWritePrefs();
54 virtual void ScheduleWritePrefs() OVERRIDE; 54 virtual void CommitPendingWrite();
55 virtual void CommitPendingWrite() OVERRIDE; 55 virtual void ReportValueChanged(const std::string& key);
56 virtual void ReportValueChanged(const std::string& key) OVERRIDE;
57 virtual void CheckIfValueDestroyed(const std::string& key) OVERRIDE;
58 56
59 // This method is called after JSON file has been read. Method takes 57 // This method is called after JSON file has been read. Method takes
60 // ownership of the |value| pointer. Note, this method is used with 58 // ownership of the |value| pointer. Note, this method is used with
61 // asynchronous file reading, so class exposes it only for the internal needs. 59 // asynchronous file reading, so class exposes it only for the internal needs.
62 // (read: do not call it manually). 60 // (read: do not call it manually).
63 void OnFileRead(base::Value* value_owned, PrefReadError error, bool no_dir); 61 void OnFileRead(base::Value* value_owned, PrefReadError error, bool no_dir);
64 62
65 private: 63 private:
66 enum SetValueType {
67 // Indicates observers should be notified of the change.
68 SET_VALUE_NOTIFY,
69
70 // Indicates observers should not be notified of the change.
71 SET_VALUE_DONT_NOTIFY
72 };
73
74 // ImportantFileWriter::DataSerializer overrides: 64 // ImportantFileWriter::DataSerializer overrides:
75 virtual bool SerializeData(std::string* output); 65 virtual bool SerializeData(std::string* output);
76 66
77 // Implementation of SetValue.
78 void SetValueImpl(const std::string& key,
79 base::Value* value,
80 SetValueType type);
81
82 static void ResetCheckIfValueDestroyed(base::Value* value);
83
84 FilePath path_; 67 FilePath path_;
85 scoped_refptr<base::MessageLoopProxy> file_message_loop_proxy_; 68 scoped_refptr<base::MessageLoopProxy> file_message_loop_proxy_;
86 69
87 scoped_ptr<base::DictionaryValue> prefs_; 70 scoped_ptr<base::DictionaryValue> prefs_;
88 71
89 bool read_only_; 72 bool read_only_;
90 73
91 // Helper for safely writing pref data. 74 // Helper for safely writing pref data.
92 ImportantFileWriter writer_; 75 ImportantFileWriter writer_;
93 76
94 ObserverList<PrefStore::Observer, true> observers_; 77 ObserverList<PrefStore::Observer, true> observers_;
95 78
96 scoped_ptr<ReadErrorDelegate> error_delegate_; 79 scoped_ptr<ReadErrorDelegate> error_delegate_;
97 80
98 bool initialized_; 81 bool initialized_;
99 82
100 DISALLOW_COPY_AND_ASSIGN(JsonPrefStore); 83 DISALLOW_COPY_AND_ASSIGN(JsonPrefStore);
101 }; 84 };
102 85
103 #endif // CHROME_COMMON_JSON_PREF_STORE_H_ 86 #endif // CHROME_COMMON_JSON_PREF_STORE_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/chrome_views_delegate.cc ('k') | chrome/common/json_pref_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698