OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "remoting/host/json_host_config.h" | 5 #include "remoting/host/json_host_config.h" |
6 | 6 |
7 #include "base/message_loop_proxy.h" | 7 #include "base/message_loop_proxy.h" |
8 #include "base/task.h" | 8 #include "base/task.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/common/json_pref_store.h" | 10 #include "chrome/common/json_pref_store.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 std::string* out_value) { | 33 std::string* out_value) { |
34 AutoLock auto_lock(lock_); | 34 AutoLock auto_lock(lock_); |
35 return pref_store_->prefs()->GetString(path, out_value); | 35 return pref_store_->prefs()->GetString(path, out_value); |
36 } | 36 } |
37 | 37 |
38 void JsonHostConfig::Update(Task* task) { | 38 void JsonHostConfig::Update(Task* task) { |
39 { | 39 { |
40 AutoLock auto_lock(lock_); | 40 AutoLock auto_lock(lock_); |
41 task->Run(); | 41 task->Run(); |
42 } | 42 } |
| 43 delete task; |
43 message_loop_proxy_->PostTask( | 44 message_loop_proxy_->PostTask( |
44 FROM_HERE, NewRunnableMethod(this, &JsonHostConfig::DoWrite)); | 45 FROM_HERE, NewRunnableMethod(this, &JsonHostConfig::DoWrite)); |
45 } | 46 } |
46 | 47 |
47 void JsonHostConfig::SetString(const std::wstring& path, | 48 void JsonHostConfig::SetString(const std::wstring& path, |
48 const std::wstring& in_value) { | 49 const std::wstring& in_value) { |
49 lock_.AssertAcquired(); | 50 lock_.AssertAcquired(); |
50 pref_store_->prefs()->SetString(path, in_value); | 51 pref_store_->prefs()->SetString(path, in_value); |
51 } | 52 } |
52 | 53 |
53 void JsonHostConfig::SetString(const std::wstring& path, | 54 void JsonHostConfig::SetString(const std::wstring& path, |
54 const std::string& in_value) { | 55 const std::string& in_value) { |
55 lock_.AssertAcquired(); | 56 lock_.AssertAcquired(); |
56 pref_store_->prefs()->SetString(path, in_value); | 57 pref_store_->prefs()->SetString(path, in_value); |
57 } | 58 } |
58 | 59 |
59 void JsonHostConfig::DoWrite() { | 60 void JsonHostConfig::DoWrite() { |
60 AutoLock auto_lock(lock_); | 61 AutoLock auto_lock(lock_); |
61 pref_store_->WritePrefs(); | 62 pref_store_->WritePrefs(); |
62 } | 63 } |
63 | 64 |
64 } // namespace remoting | 65 } // namespace remoting |
OLD | NEW |