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

Side by Side Diff: components/test_runner/tracked_dictionary.h

Issue 1715573002: Replicating LayoutDumpFlags across OOPIFs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@replicating-pixel-dump-flag
Patch Set: Removed unneeded include. Created 4 years, 9 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
« no previous file with comments | « components/test_runner/test_runner.gyp ('k') | components/test_runner/tracked_dictionary.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_TEST_RUNNER_TRACKED_DICTIONARY_H_
6 #define COMPONENTS_TEST_RUNNER_TRACKED_DICTIONARY_H_
7
8 #include <string>
9
10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/values.h"
13 #include "components/test_runner/test_runner_export.h"
14
15 namespace test_runner {
16
17 // TrackedDictionary wraps base::DictionaryValue, but forces all mutations to go
18 // through TrackedDictionary's Set methods. This allows tracking of changes
19 // accumulated since the last call to ResetChangeTracking.
20 class TEST_RUNNER_EXPORT TrackedDictionary {
21 public:
22 TrackedDictionary();
23
24 // Current value of the tracked dictionary.
25 const base::DictionaryValue& current_values() const {
26 return current_values_;
27 }
28
29 // Subset of |current_values| that have been changed (i.e. via Set method)
30 // since the last call to ResetChangeTracking.
31 const base::DictionaryValue& changed_values() const {
32 return changed_values_;
33 }
34
35 // Clears out |changed_values|.
36 void ResetChangeTracking();
37
38 // Overwrites |current_values| with values present in |new_changes|.
39 // The new values are not present in |changed_values| afterwards.
40 void ApplyUntrackedChanges(const base::DictionaryValue& new_changes);
41
42 // Sets a value in |current_values| and tracks the change in |changed_values|.
43 void Set(const std::string& path, scoped_ptr<base::Value> new_value);
44
45 // Type-specific setter for convenience.
46 void SetBoolean(const std::string& path, bool new_value);
47
48 private:
49 base::DictionaryValue current_values_;
50 base::DictionaryValue changed_values_;
51
52 DISALLOW_COPY_AND_ASSIGN(TrackedDictionary);
53 };
54
55 } // namespace test_runner
56
57 #endif // COMPONENTS_TEST_RUNNER_TRACKED_DICTIONARY_H_
OLDNEW
« no previous file with comments | « components/test_runner/test_runner.gyp ('k') | components/test_runner/tracked_dictionary.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698