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

Unified Diff: components/net_log/net_log_temp_file.h

Issue 1347043002: Move ChromeNetLog to //components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DetachFromThread Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: components/net_log/net_log_temp_file.h
diff --git a/chrome/browser/net/net_log_temp_file.h b/components/net_log/net_log_temp_file.h
similarity index 86%
rename from chrome/browser/net/net_log_temp_file.h
rename to components/net_log/net_log_temp_file.h
index 2ab197fe59d213b0f6b72e018b331f7218b261d6..164b5ece4b9f22c3b02aefe370ab7add79345392 100644
--- a/chrome/browser/net/net_log_temp_file.h
+++ b/components/net_log/net_log_temp_file.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_NET_NET_LOG_TEMP_FILE_H_
-#define CHROME_BROWSER_NET_NET_LOG_TEMP_FILE_H_
+#ifndef COMPONENTS_NET_LOG_NET_LOG_TEMP_FILE_H_
+#define COMPONENTS_NET_LOG_NET_LOG_TEMP_FILE_H_
#include <string>
@@ -11,6 +11,7 @@
#include "base/files/file_path.h"
#include "base/gtest_prod_util.h"
#include "base/memory/scoped_ptr.h"
+#include "base/threading/thread_checker.h"
#include "net/log/net_log.h"
namespace base {
@@ -21,6 +22,8 @@ namespace net {
class WriteToFileNetLogObserver;
}
+namespace net_log {
+
class ChromeNetLog;
// NetLogTempFile logs all the NetLog entries into a temporary file
@@ -35,19 +38,18 @@ class ChromeNetLog;
// c) Either Send or Start is allowed (STATE_NOT_LOGGING, anything but
// LOG_TYPE_NONE).
//
-// This is created/destroyed on the UI thread, but all other function calls
-// occur on the FILE_USER_BLOCKING thread.
+// This is created/destroyed on the main thread, but all other function calls
+// occur on a background thread.
//
-// This relies on the UI thread outlasting all other named threads for thread
-// safety.
+// This relies on the UI thread outlasting all other threads for thread safety.
class NetLogTempFile {
public:
// This enum lists the UI button commands it could receive.
enum Command {
DO_START_LOG_BYTES, // Call StartNetLog logging all bytes received.
- DO_START, // Call StartNetLog.
+ DO_START, // Call StartNetLog.
DO_START_STRIP_PRIVATE_DATA, // Call StartNetLog stripping private data.
- DO_STOP, // Call StopNetLog.
+ DO_STOP, // Call StopNetLog.
};
virtual ~NetLogTempFile();
@@ -67,12 +69,12 @@ class NetLogTempFile {
protected:
// Constructs a NetLogTempFile. Only one instance is created in browser
// process.
- explicit NetLogTempFile(ChromeNetLog* chrome_net_log);
+ NetLogTempFile(ChromeNetLog* chrome_net_log,
+ const std::string& channel_string);
// Returns path name to base::GetTempDir() directory. Returns false if
// base::GetTempDir() fails.
- virtual bool GetNetExportLogBaseDirectory(
- base::FilePath* path) const;
+ virtual bool GetNetExportLogBaseDirectory(base::FilePath* path) const;
private:
friend class ChromeNetLog;
@@ -140,11 +142,13 @@ class NetLogTempFile {
// Returns true if a file exists at |log_path_|.
bool NetExportLogExists() const;
+ base::ThreadChecker thread_checker_;
+
// Helper function for unit tests.
State state() const { return state_; }
LogType log_type() const { return log_type_; }
- State state_; // Current state of NetLogTempFile.
+ State state_; // Current state of NetLogTempFile.
LogType log_type_; // Type of current log file on disk.
base::FilePath log_path_; // base::FilePath to the temporary file.
@@ -157,7 +161,11 @@ class NetLogTempFile {
// using global (g_browser_process).
ChromeNetLog* chrome_net_log_;
+ std::string channel_string_;
+
DISALLOW_COPY_AND_ASSIGN(NetLogTempFile);
};
-#endif // CHROME_BROWSER_NET_NET_LOG_TEMP_FILE_H_
+} // namespace net_log
+
+#endif // COMPONENTS_NET_LOG_NET_LOG_TEMP_FILE_H_

Powered by Google App Engine
This is Rietveld 408576698