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

Side by Side Diff: components/cronet/android/cronet_url_request_context_adapter.cc

Issue 2966283002: Remove the file thread dependency from FileNetLogObserver. (Closed)
Patch Set: undo const-ref changes Created 3 years, 5 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
« no previous file with comments | « no previous file | components/net_log/net_export_file_writer.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/cronet/android/cronet_url_request_context_adapter.h" 5 #include "components/cronet/android/cronet_url_request_context_adapter.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 1020
1021 void CronetURLRequestContextAdapter::StartNetLogOnNetworkThread( 1021 void CronetURLRequestContextAdapter::StartNetLogOnNetworkThread(
1022 const base::FilePath& file_path, 1022 const base::FilePath& file_path,
1023 bool include_socket_bytes) { 1023 bool include_socket_bytes) {
1024 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread()); 1024 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread());
1025 1025
1026 // Do nothing if already logging to a file. 1026 // Do nothing if already logging to a file.
1027 if (net_log_file_observer_) 1027 if (net_log_file_observer_)
1028 return; 1028 return;
1029 net_log_file_observer_ = net::FileNetLogObserver::CreateUnbounded( 1029 net_log_file_observer_ = net::FileNetLogObserver::CreateUnbounded(
1030 GetFileThread()->task_runner(), file_path, /*constants=*/nullptr); 1030 file_path, /*constants=*/nullptr);
1031 CreateNetLogEntriesForActiveObjects({context_.get()}, 1031 CreateNetLogEntriesForActiveObjects({context_.get()},
1032 net_log_file_observer_.get()); 1032 net_log_file_observer_.get());
1033 net::NetLogCaptureMode capture_mode = 1033 net::NetLogCaptureMode capture_mode =
1034 include_socket_bytes ? net::NetLogCaptureMode::IncludeSocketBytes() 1034 include_socket_bytes ? net::NetLogCaptureMode::IncludeSocketBytes()
1035 : net::NetLogCaptureMode::Default(); 1035 : net::NetLogCaptureMode::Default();
1036 net_log_file_observer_->StartObserving(g_net_log.Get().net_log(), 1036 net_log_file_observer_->StartObserving(g_net_log.Get().net_log(),
1037 capture_mode); 1037 capture_mode);
1038 } 1038 }
1039 1039
1040 void CronetURLRequestContextAdapter::StartNetLogToBoundedFileOnNetworkThread( 1040 void CronetURLRequestContextAdapter::StartNetLogToBoundedFileOnNetworkThread(
1041 const std::string& dir_path, 1041 const std::string& dir_path,
1042 bool include_socket_bytes, 1042 bool include_socket_bytes,
1043 int size) { 1043 int size) {
1044 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread()); 1044 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread());
1045 1045
1046 // Do nothing if already logging to a directory. 1046 // Do nothing if already logging to a directory.
1047 if (net_log_file_observer_) 1047 if (net_log_file_observer_)
1048 return; 1048 return;
1049 1049
1050 // Filepath for NetLog files must exist and be writable. 1050 // Filepath for NetLog files must exist and be writable.
1051 base::FilePath file_path(dir_path); 1051 base::FilePath file_path(dir_path);
1052 DCHECK(base::PathIsWritable(file_path)); 1052 DCHECK(base::PathIsWritable(file_path));
1053 1053
1054 net_log_file_observer_ = net::FileNetLogObserver::CreateBounded( 1054 net_log_file_observer_ = net::FileNetLogObserver::CreateBounded(
1055 GetFileThread()->task_runner(), file_path, size, kNumNetLogEventFiles, 1055 file_path, size, kNumNetLogEventFiles, /*constants=*/nullptr);
1056 /*constants=*/nullptr);
1057 1056
1058 CreateNetLogEntriesForActiveObjects({context_.get()}, 1057 CreateNetLogEntriesForActiveObjects({context_.get()},
1059 net_log_file_observer_.get()); 1058 net_log_file_observer_.get());
1060 1059
1061 net::NetLogCaptureMode capture_mode = 1060 net::NetLogCaptureMode capture_mode =
1062 include_socket_bytes ? net::NetLogCaptureMode::IncludeSocketBytes() 1061 include_socket_bytes ? net::NetLogCaptureMode::IncludeSocketBytes()
1063 : net::NetLogCaptureMode::Default(); 1062 : net::NetLogCaptureMode::Default();
1064 net_log_file_observer_->StartObserving(g_net_log.Get().net_log(), 1063 net_log_file_observer_->StartObserving(g_net_log.Get().net_log(),
1065 capture_mode); 1064 capture_mode);
1066 } 1065 }
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1212 JNIEnv* env, 1211 JNIEnv* env,
1213 const JavaParamRef<jclass>& jcaller) { 1212 const JavaParamRef<jclass>& jcaller) {
1214 DCHECK(base::StatisticsRecorder::IsActive()); 1213 DCHECK(base::StatisticsRecorder::IsActive());
1215 std::vector<uint8_t> data; 1214 std::vector<uint8_t> data;
1216 if (!HistogramManager::GetInstance()->GetDeltas(&data)) 1215 if (!HistogramManager::GetInstance()->GetDeltas(&data))
1217 return ScopedJavaLocalRef<jbyteArray>(); 1216 return ScopedJavaLocalRef<jbyteArray>();
1218 return base::android::ToJavaByteArray(env, &data[0], data.size()); 1217 return base::android::ToJavaByteArray(env, &data[0], data.size());
1219 } 1218 }
1220 1219
1221 } // namespace cronet 1220 } // namespace cronet
OLDNEW
« no previous file with comments | « no previous file | components/net_log/net_export_file_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698