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

Unified Diff: net/tools/flip_server/mem_cache.cc

Issue 93793004: Format and Refactor Flip Server. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 7 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/tools/flip_server/mem_cache.h ('k') | net/tools/flip_server/mem_cache_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/flip_server/mem_cache.cc
diff --git a/net/tools/flip_server/mem_cache.cc b/net/tools/flip_server/mem_cache.cc
index 42d93430ee3704053105e308e2bab4ed5b661039..521f56cbf7194b62fa3573f114efaeb882952550 100644
--- a/net/tools/flip_server/mem_cache.cc
+++ b/net/tools/flip_server/mem_cache.cc
@@ -29,7 +29,7 @@ const char FLAGS_cache_base_dir[] = ".";
namespace net {
-void StoreBodyAndHeadersVisitor::ProcessBodyData(const char *input,
+void StoreBodyAndHeadersVisitor::ProcessBodyData(const char* input,
size_t size) {
body.append(input, size);
}
@@ -53,8 +53,7 @@ void StoreBodyAndHeadersVisitor::HandleBodyError(BalsaFrame* framer) {
FileData::FileData(const BalsaHeaders* headers,
const std::string& filename,
const std::string& body)
- : filename_(filename)
- , body_(body) {
+ : filename_(filename), body_(body) {
if (headers) {
headers_.reset(new BalsaHeaders);
headers_->CopyFrom(*headers);
@@ -67,9 +66,7 @@ FileData::~FileData() {}
MemoryCache::MemoryCache() : cwd_(FLAGS_cache_base_dir) {}
-MemoryCache::~MemoryCache() {
- ClearFiles();
-}
+MemoryCache::~MemoryCache() { ClearFiles(); }
void MemoryCache::CloneFrom(const MemoryCache& mc) {
DCHECK_NE(this, &mc);
@@ -97,11 +94,10 @@ void MemoryCache::AddFiles() {
if (current_dir) {
VLOG(1) << "Succeeded opening";
- for (struct dirent* dir_data = readdir(current_dir);
- dir_data != NULL;
+ for (struct dirent* dir_data = readdir(current_dir); dir_data != NULL;
dir_data = readdir(current_dir)) {
std::string current_entry_name =
- current_dir_name + "/" + dir_data->d_name;
+ current_dir_name + "/" + dir_data->d_name;
if (dir_data->d_type == DT_REG) {
VLOG(1) << "Found file: " << current_entry_name;
ReadAndStoreFileContents(current_entry_name.c_str());
@@ -158,7 +154,7 @@ void MemoryCache::ReadAndStoreFileContents(const char* filename) {
filename_contents.size() - pos);
if (framer.Error() || pos == old_pos) {
LOG(ERROR) << "Unable to make forward progress, or error"
- " framing file: " << filename;
+ " framing file: " << filename;
if (framer.Error()) {
LOG(INFO) << "********************************************ERROR!";
return;
@@ -180,9 +176,9 @@ void MemoryCache::ReadAndStoreFileContents(const char* filename) {
visitor.headers.AppendHeader("transfer-encoding", "chunked");
visitor.headers.AppendHeader("connection", "keep-alive");
- // Experiment with changing headers for forcing use of cached
- // versions of content.
- // TODO(mbelshe) REMOVE ME
+// Experiment with changing headers for forcing use of cached
+// versions of content.
+// TODO(mbelshe) REMOVE ME
#if 0
// TODO(mbelshe) append current date.
visitor.headers.RemoveAllOfHeader("date");
@@ -196,15 +192,14 @@ void MemoryCache::ReadAndStoreFileContents(const char* filename) {
DCHECK_EQ(std::string(filename).substr(0, cwd_.size()), cwd_);
DCHECK_EQ(filename[cwd_.size()], '/');
std::string filename_stripped = std::string(filename).substr(cwd_.size() + 1);
- LOG(INFO) << "Adding file (" << visitor.body.length() << " bytes): "
- << filename_stripped;
+ LOG(INFO) << "Adding file (" << visitor.body.length()
+ << " bytes): " << filename_stripped;
size_t slash_pos = filename_stripped.find('/');
if (slash_pos == std::string::npos) {
slash_pos = filename_stripped.size();
}
- InsertFile(&visitor.headers,
- filename_stripped.substr(0, slash_pos),
- visitor.body);
+ InsertFile(
+ &visitor.headers, filename_stripped.substr(0, slash_pos), visitor.body);
}
FileData* MemoryCache::GetFileData(const std::string& filename) {
« no previous file with comments | « net/tools/flip_server/mem_cache.h ('k') | net/tools/flip_server/mem_cache_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698