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

Side by Side Diff: dm/DMJsonWriter.cpp

Issue 2206633004: Move off SK_SUPPORT_LEGACY_DATA_FACTORIES. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Gotta catch 'em all. Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "DMJsonWriter.h" 8 #include "DMJsonWriter.h"
9 9
10 #include "ProcStats.h" 10 #include "ProcStats.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 88 }
89 89
90 SkString path = SkOSPath::Join(FLAGS_writePath[0], "dm.json"); 90 SkString path = SkOSPath::Join(FLAGS_writePath[0], "dm.json");
91 sk_mkdir(FLAGS_writePath[0]); 91 sk_mkdir(FLAGS_writePath[0]);
92 SkFILEWStream stream(path.c_str()); 92 SkFILEWStream stream(path.c_str());
93 stream.writeText(Json::StyledWriter().write(root).c_str()); 93 stream.writeText(Json::StyledWriter().write(root).c_str());
94 stream.flush(); 94 stream.flush();
95 } 95 }
96 96
97 bool JsonWriter::ReadJson(const char* path, void(*callback)(BitmapResult)) { 97 bool JsonWriter::ReadJson(const char* path, void(*callback)(BitmapResult)) {
98 SkAutoTUnref<SkData> json(SkData::NewFromFileName(path)); 98 sk_sp<SkData> json(SkData::MakeFromFileName(path));
99 if (!json) { 99 if (!json) {
100 return false; 100 return false;
101 } 101 }
102 102
103 Json::Reader reader; 103 Json::Reader reader;
104 Json::Value root; 104 Json::Value root;
105 const char* data = (const char*)json->data(); 105 const char* data = (const char*)json->data();
106 if (!reader.parse(data, data+json->size(), root)) { 106 if (!reader.parse(data, data+json->size(), root)) {
107 return false; 107 return false;
108 } 108 }
(...skipping 11 matching lines...) Expand all
120 120
121 if (!r["key"]["source_options"].isNull()) { 121 if (!r["key"]["source_options"].isNull()) {
122 br.sourceOptions = r["key"]["source_options"].asCString(); 122 br.sourceOptions = r["key"]["source_options"].asCString();
123 } 123 }
124 callback(br); 124 callback(br);
125 } 125 }
126 return true; 126 return true;
127 } 127 }
128 128
129 } // namespace DM 129 } // namespace DM
OLDNEW
« no previous file with comments | « dm/DM.cpp ('k') | dm/DMSrcSink.cpp » ('j') | include/core/SkData.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698