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

Side by Side Diff: components/update_client/component_patcher.cc

Issue 925783002: Split ValueSerializer into separate Serializer and Deserializer classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed cpplint warnings. Created 5 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
OLDNEW
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 "components/update_client/component_patcher.h" 5 #include "components/update_client/component_patcher.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 12 matching lines...) Expand all
23 namespace { 23 namespace {
24 24
25 // Deserialize the commands file (present in delta update packages). The top 25 // Deserialize the commands file (present in delta update packages). The top
26 // level must be a list. 26 // level must be a list.
27 base::ListValue* ReadCommands(const base::FilePath& unpack_path) { 27 base::ListValue* ReadCommands(const base::FilePath& unpack_path) {
28 const base::FilePath commands = 28 const base::FilePath commands =
29 unpack_path.Append(FILE_PATH_LITERAL("commands.json")); 29 unpack_path.Append(FILE_PATH_LITERAL("commands.json"));
30 if (!base::PathExists(commands)) 30 if (!base::PathExists(commands))
31 return NULL; 31 return NULL;
32 32
33 JSONFileValueSerializer serializer(commands); 33 JSONFileValueDeserializer deserializer(commands);
34 scoped_ptr<base::Value> root(serializer.Deserialize(NULL, NULL)); 34 scoped_ptr<base::Value> root(deserializer.Deserialize(NULL, NULL));
35 35
36 return (root.get() && root->IsType(base::Value::TYPE_LIST)) 36 return (root.get() && root->IsType(base::Value::TYPE_LIST))
37 ? static_cast<base::ListValue*>(root.release()) 37 ? static_cast<base::ListValue*>(root.release())
38 : NULL; 38 : NULL;
39 } 39 }
40 40
41 } // namespace 41 } // namespace
42 42
43 ComponentPatcher::ComponentPatcher( 43 ComponentPatcher::ComponentPatcher(
44 const base::FilePath& input_dir, 44 const base::FilePath& input_dir,
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 113
114 void ComponentPatcher::DonePatching(ComponentUnpacker::Error error, 114 void ComponentPatcher::DonePatching(ComponentUnpacker::Error error,
115 int extended_error) { 115 int extended_error) {
116 current_operation_ = NULL; 116 current_operation_ = NULL;
117 task_runner_->PostTask(FROM_HERE, 117 task_runner_->PostTask(FROM_HERE,
118 base::Bind(callback_, error, extended_error)); 118 base::Bind(callback_, error, extended_error));
119 callback_.Reset(); 119 callback_.Reset();
120 } 120 }
121 121
122 } // namespace update_client 122 } // namespace update_client
OLDNEW
« no previous file with comments | « components/policy/core/common/config_dir_policy_loader.cc ('k') | components/update_client/component_unpacker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698