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

Side by Side Diff: components/nacl/browser/nacl_browser.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 "components/nacl/browser/nacl_browser.h" 5 #include "components/nacl/browser/nacl_browser.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } 81 }
82 82
83 void ReadCache(const base::FilePath& filename, std::string* data) { 83 void ReadCache(const base::FilePath& filename, std::string* data) {
84 if (!base::ReadFileToString(filename, data)) { 84 if (!base::ReadFileToString(filename, data)) {
85 // Zero-size data used as an in-band error code. 85 // Zero-size data used as an in-band error code.
86 data->clear(); 86 data->clear();
87 } 87 }
88 } 88 }
89 89
90 void WriteCache(const base::FilePath& filename, const Pickle* pickle) { 90 void WriteCache(const base::FilePath& filename, const Pickle* pickle) {
91 file_util::WriteFile(filename, static_cast<const char*>(pickle->data()), 91 base::WriteFile(filename, static_cast<const char*>(pickle->data()),
92 pickle->size()); 92 pickle->size());
93 } 93 }
94 94
95 void RemoveCache(const base::FilePath& filename, 95 void RemoveCache(const base::FilePath& filename,
96 const base::Closure& callback) { 96 const base::Closure& callback) {
97 base::DeleteFile(filename, false); 97 base::DeleteFile(filename, false);
98 content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, 98 content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE,
99 callback); 99 callback);
100 } 100 }
101 101
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 bool NaClBrowser::IsThrottled() { 555 bool NaClBrowser::IsThrottled() {
556 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); 556 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
557 if (crash_times_.size() != kMaxCrashesPerInterval) { 557 if (crash_times_.size() != kMaxCrashesPerInterval) {
558 return false; 558 return false;
559 } 559 }
560 base::TimeDelta delta = base::Time::Now() - crash_times_.front(); 560 base::TimeDelta delta = base::Time::Now() - crash_times_.front();
561 return delta.InSeconds() <= kCrashesIntervalInSeconds; 561 return delta.InSeconds() <= kCrashesIntervalInSeconds;
562 } 562 }
563 563
564 } // namespace nacl 564 } // namespace nacl
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698