OLD | NEW |
---|---|
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 |
11 #include <limits> | 11 #include <limits> |
12 #include <map> | 12 #include <map> |
13 #include <set> | |
xunjieli
2017/02/24 18:49:03
why is this needed?
wangyix1
2017/02/24 22:07:19
The first param to CreateNetLogEntriesForActiveObj
xunjieli
2017/02/24 22:10:08
Acknowledged.
eroman
2017/02/24 23:43:45
I don't think you quite answered Helen's question.
| |
13 #include <utility> | 14 #include <utility> |
14 #include <vector> | 15 #include <vector> |
15 | 16 |
16 #include "base/android/jni_android.h" | 17 #include "base/android/jni_android.h" |
17 #include "base/android/jni_array.h" | 18 #include "base/android/jni_array.h" |
18 #include "base/android/jni_string.h" | 19 #include "base/android/jni_string.h" |
19 #include "base/base64.h" | 20 #include "base/base64.h" |
20 #include "base/bind.h" | 21 #include "base/bind.h" |
21 #include "base/callback.h" | 22 #include "base/callback.h" |
22 #include "base/files/file_path.h" | 23 #include "base/files/file_path.h" |
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1015 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread()); | 1016 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread()); |
1016 | 1017 |
1017 // Do nothing if already logging to a directory. | 1018 // Do nothing if already logging to a directory. |
1018 if (bounded_file_observer_) | 1019 if (bounded_file_observer_) |
1019 return; | 1020 return; |
1020 | 1021 |
1021 // Filepath for NetLog files must exist and be writable. | 1022 // Filepath for NetLog files must exist and be writable. |
1022 base::FilePath file_path(dir_path); | 1023 base::FilePath file_path(dir_path); |
1023 DCHECK(base::PathIsWritable(file_path)); | 1024 DCHECK(base::PathIsWritable(file_path)); |
1024 | 1025 |
1025 bounded_file_observer_.reset( | 1026 bounded_file_observer_ = net::FileNetLogObserver::CreateBounded( |
1026 new net::FileNetLogObserver(GetFileThread()->task_runner())); | 1027 GetFileThread()->task_runner(), file_path, size, kNumNetLogEventFiles, |
1028 /*constants=*/nullptr); | |
1029 | |
1030 CreateNetLogEntriesForActiveObjects({context_.get()}, | |
1031 bounded_file_observer_.get()); | |
1027 | 1032 |
1028 net::NetLogCaptureMode capture_mode = | 1033 net::NetLogCaptureMode capture_mode = |
1029 include_socket_bytes ? net::NetLogCaptureMode::IncludeSocketBytes() | 1034 include_socket_bytes ? net::NetLogCaptureMode::IncludeSocketBytes() |
1030 : net::NetLogCaptureMode::Default(); | 1035 : net::NetLogCaptureMode::Default(); |
1031 | 1036 bounded_file_observer_->StartObserving(g_net_log.Get().net_log(), |
1032 bounded_file_observer_->StartObservingBounded( | 1037 capture_mode); |
1033 g_net_log.Get().net_log(), capture_mode, file_path, | |
1034 /*constants=*/nullptr, context_.get(), size, kNumNetLogEventFiles); | |
1035 } | 1038 } |
1036 | 1039 |
1037 void CronetURLRequestContextAdapter::StopBoundedFileNetLogOnNetworkThread() { | 1040 void CronetURLRequestContextAdapter::StopBoundedFileNetLogOnNetworkThread() { |
1038 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread()); | 1041 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread()); |
1039 bounded_file_observer_->StopObserving( | 1042 bounded_file_observer_->StopObserving( |
1040 net::GetNetInfo(context_.get(), net::NET_INFO_ALL_SOURCES), | 1043 net::GetNetInfo(context_.get(), net::NET_INFO_ALL_SOURCES), |
1041 base::Bind(&CronetURLRequestContextAdapter::StopNetLogCompleted, | 1044 base::Bind(&CronetURLRequestContextAdapter::StopNetLogCompleted, |
1042 base::Unretained(this))); | 1045 base::Unretained(this))); |
1043 bounded_file_observer_.reset(); | 1046 bounded_file_observer_.reset(); |
1044 } | 1047 } |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1190 JNIEnv* env, | 1193 JNIEnv* env, |
1191 const JavaParamRef<jclass>& jcaller) { | 1194 const JavaParamRef<jclass>& jcaller) { |
1192 base::StatisticsRecorder::Initialize(); | 1195 base::StatisticsRecorder::Initialize(); |
1193 std::vector<uint8_t> data; | 1196 std::vector<uint8_t> data; |
1194 if (!HistogramManager::GetInstance()->GetDeltas(&data)) | 1197 if (!HistogramManager::GetInstance()->GetDeltas(&data)) |
1195 return ScopedJavaLocalRef<jbyteArray>(); | 1198 return ScopedJavaLocalRef<jbyteArray>(); |
1196 return base::android::ToJavaByteArray(env, &data[0], data.size()); | 1199 return base::android::ToJavaByteArray(env, &data[0], data.size()); |
1197 } | 1200 } |
1198 | 1201 |
1199 } // namespace cronet | 1202 } // namespace cronet |
OLD | NEW |