summaryrefslogtreecommitdiffstats
path: root/remoting/host/in_memory_host_config.cc
blob: e0cf1206cbe4ba630259168d4e64782d1f1fe662 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "remoting/host/in_memory_host_config.h"

#include "base/task.h"
#include "base/values.h"

namespace remoting {

InMemoryHostConfig::InMemoryHostConfig()
    : values_(new DictionaryValue()) {
}

InMemoryHostConfig::~InMemoryHostConfig() {}

bool InMemoryHostConfig::GetString(const std::string& path,
                                   std::string* out_value) {
  AutoLock auto_lock(lock_);
  return values_->GetString(path, out_value);
}

void InMemoryHostConfig::Update(Task* task) {
  {
    AutoLock auto_lock(lock_);
    task->Run();
  }
  delete task;
}

void InMemoryHostConfig::SetString(const std::string& path,
                                   const std::string& in_value) {
  lock_.AssertAcquired();
  values_->SetString(path, in_value);
}

}  // namespace remoting