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

Side by Side Diff: chrome/browser/net/net_log_logger.cc

Issue 9166009: Move about:net-internals webui files into a subdirectory + OWNERS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Update year Created 8 years, 11 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
« no previous file with comments | « WATCHLISTS ('k') | chrome/browser/ui/webui/chrome_web_ui_factory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/net/net_log_logger.h" 5 #include "chrome/browser/net/net_log_logger.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/threading/thread_restrictions.h" 12 #include "base/threading/thread_restrictions.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/browser/ui/webui/net_internals_ui.h" 14 #include "chrome/browser/ui/webui/net_internals/net_internals_ui.h"
15 15
16 NetLogLogger::NetLogLogger(const FilePath &log_path) 16 NetLogLogger::NetLogLogger(const FilePath &log_path)
17 : ThreadSafeObserverImpl(net::NetLog::LOG_ALL_BUT_BYTES) { 17 : ThreadSafeObserverImpl(net::NetLog::LOG_ALL_BUT_BYTES) {
18 if (!log_path.empty()) { 18 if (!log_path.empty()) {
19 base::ThreadRestrictions::ScopedAllowIO allow_io; 19 base::ThreadRestrictions::ScopedAllowIO allow_io;
20 file_.Set(file_util::OpenFile(log_path, "w")); 20 file_.Set(file_util::OpenFile(log_path, "w"));
21 21
22 // Write constants to the output file. This allows loading files that have 22 // Write constants to the output file. This allows loading files that have
23 // different source and event types, as they may be added and removed 23 // different source and event types, as they may be added and removed
24 // between Chrome versions. 24 // between Chrome versions.
(...skipping 21 matching lines...) Expand all
46 // instead of integer identifiers allows logs from older versions to be 46 // instead of integer identifiers allows logs from older versions to be
47 // loaded, though a little extra parsing has to be done when loading a log. 47 // loaded, though a little extra parsing has to be done when loading a log.
48 std::string json; 48 std::string json;
49 base::JSONWriter::Write(value.get(), false, &json); 49 base::JSONWriter::Write(value.get(), false, &json);
50 if (!file_.get()) { 50 if (!file_.get()) {
51 VLOG(1) << json; 51 VLOG(1) << json;
52 } else { 52 } else {
53 fprintf(file_.get(), "%s,\n", json.c_str()); 53 fprintf(file_.get(), "%s,\n", json.c_str());
54 } 54 }
55 } 55 }
OLDNEW
« no previous file with comments | « WATCHLISTS ('k') | chrome/browser/ui/webui/chrome_web_ui_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698