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

Side by Side Diff: chrome/browser/media/webrtc_log_uploader.cc

Issue 184563006: Move WriteFile and WriteFileDescriptor from file_util to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/media/webrtc_log_uploader.h" 5 #include "chrome/browser/media/webrtc_log_uploader.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/shared_memory.h" 10 #include "base/memory/shared_memory.h"
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 // check and + 1 to get the length. 295 // check and + 1 to get the length.
296 contents.erase(0, i + 2); 296 contents.erase(0, i + 2);
297 } 297 }
298 } 298 }
299 299
300 // Write the Unix time and report ID to the log list file. 300 // Write the Unix time and report ID to the log list file.
301 base::Time time_now = base::Time::Now(); 301 base::Time time_now = base::Time::Now();
302 contents += base::DoubleToString(time_now.ToDoubleT()) + 302 contents += base::DoubleToString(time_now.ToDoubleT()) +
303 "," + report_id + '\n'; 303 "," + report_id + '\n';
304 304
305 int written = file_util::WriteFile(upload_list_path, &contents[0], 305 int written =
306 contents.size()); 306 base::WriteFile(upload_list_path, &contents[0], contents.size());
307 DPCHECK(written == static_cast<int>(contents.size())); 307 DPCHECK(written == static_cast<int>(contents.size()));
308 } 308 }
309 309
310 void WebRtcLogUploader::NotifyUploadDone( 310 void WebRtcLogUploader::NotifyUploadDone(
311 int response_code, 311 int response_code,
312 const std::string& report_id, 312 const std::string& report_id,
313 const WebRtcLogUploadDoneData& upload_done_data) { 313 const WebRtcLogUploadDoneData& upload_done_data) {
314 content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, 314 content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE,
315 base::Bind(&WebRtcLoggingHandlerHost::UploadLogDone, 315 base::Bind(&WebRtcLoggingHandlerHost::UploadLogDone,
316 upload_done_data.host)); 316 upload_done_data.host));
317 if (!upload_done_data.callback.is_null()) { 317 if (!upload_done_data.callback.is_null()) {
318 bool success = response_code == kHttpResponseOk; 318 bool success = response_code == kHttpResponseOk;
319 std::string error_message; 319 std::string error_message;
320 if (!success) { 320 if (!success) {
321 error_message = "Uploading failed, response code: " + 321 error_message = "Uploading failed, response code: " +
322 base::IntToString(response_code); 322 base::IntToString(response_code);
323 } 323 }
324 content::BrowserThread::PostTask( 324 content::BrowserThread::PostTask(
325 content::BrowserThread::UI, FROM_HERE, 325 content::BrowserThread::UI, FROM_HERE,
326 base::Bind(upload_done_data.callback, success, report_id, 326 base::Bind(upload_done_data.callback, success, report_id,
327 error_message)); 327 error_message));
328 } 328 }
329 } 329 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698