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

Side by Side Diff: content/browser/webrtc/webrtc_eventlog_host.cc

Issue 2867693004: Snapshot of all changes to get jumbo in blink and content.
Patch Set: Exclude certain files from jumbo because of a Windows problem Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "content/browser/webrtc/webrtc_eventlog_host.h" 5 #include "content/browser/webrtc/webrtc_eventlog_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 28 matching lines...) Expand all
39 39
40 // Appends the IDs to the RTC event log file name. 40 // Appends the IDs to the RTC event log file name.
41 base::FilePath GetWebRtcEventLogPath(const base::FilePath& base_file, 41 base::FilePath GetWebRtcEventLogPath(const base::FilePath& base_file,
42 int render_process_id, 42 int render_process_id,
43 int connection_id) { 43 int connection_id) {
44 return base_file.AddExtension(IntToStringType(render_process_id)) 44 return base_file.AddExtension(IntToStringType(render_process_id))
45 .AddExtension(IntToStringType(connection_id)); 45 .AddExtension(IntToStringType(connection_id));
46 } 46 }
47 47
48 // Opens a logfile to pass on to the renderer. 48 // Opens a logfile to pass on to the renderer.
49 IPC::PlatformFileForTransit CreateFileForProcess( 49 IPC::PlatformFileForTransit CreateFileForProcess2(
50 const base::FilePath& base_path, 50 const base::FilePath& base_path,
51 int render_process_id, 51 int render_process_id,
52 int connection_id) { 52 int connection_id) {
53 base::ThreadRestrictions::AssertIOAllowed(); 53 base::ThreadRestrictions::AssertIOAllowed();
54 base::FilePath file_path = 54 base::FilePath file_path =
55 GetWebRtcEventLogPath(base_path, render_process_id, connection_id); 55 GetWebRtcEventLogPath(base_path, render_process_id, connection_id);
56 base::File event_log_file( 56 base::File event_log_file(
57 file_path, base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE); 57 file_path, base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE);
58 if (!event_log_file.IsValid()) { 58 if (!event_log_file.IsValid()) {
59 PLOG(ERROR) << "Could not open WebRTC event log file, error=" 59 PLOG(ERROR) << "Could not open WebRTC event log file, error="
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 base::WeakPtr<WebRTCEventLogHost> WebRTCEventLogHost::GetWeakPtr() { 131 base::WeakPtr<WebRTCEventLogHost> WebRTCEventLogHost::GetWeakPtr() {
132 return weak_ptr_factory_.GetWeakPtr(); 132 return weak_ptr_factory_.GetWeakPtr();
133 } 133 }
134 134
135 bool WebRTCEventLogHost::StartEventLogForPeerConnection( 135 bool WebRTCEventLogHost::StartEventLogForPeerConnection(
136 int peer_connection_local_id) { 136 int peer_connection_local_id) {
137 if (number_active_log_files_ < kMaxNumberLogFiles) { 137 if (number_active_log_files_ < kMaxNumberLogFiles) {
138 ++number_active_log_files_; 138 ++number_active_log_files_;
139 base::PostTaskWithTraitsAndReplyWithResult( 139 base::PostTaskWithTraitsAndReplyWithResult(
140 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, 140 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND},
141 base::Bind(&CreateFileForProcess, base_file_path_, render_process_id_, 141 base::Bind(&CreateFileForProcess2, base_file_path_, render_process_id_,
142 peer_connection_local_id), 142 peer_connection_local_id),
143 base::Bind(&WebRTCEventLogHost::SendEventLogFileToRenderer, 143 base::Bind(&WebRTCEventLogHost::SendEventLogFileToRenderer,
144 weak_ptr_factory_.GetWeakPtr(), peer_connection_local_id)); 144 weak_ptr_factory_.GetWeakPtr(), peer_connection_local_id));
145 } 145 }
146 return true; 146 return true;
147 } 147 }
148 148
149 void WebRTCEventLogHost::SendEventLogFileToRenderer( 149 void WebRTCEventLogHost::SendEventLogFileToRenderer(
150 int peer_connection_local_id, 150 int peer_connection_local_id,
151 IPC::PlatformFileForTransit file_for_transit) { 151 IPC::PlatformFileForTransit file_for_transit) {
152 if (file_for_transit == IPC::InvalidPlatformFileForTransit()) { 152 if (file_for_transit == IPC::InvalidPlatformFileForTransit()) {
153 --number_active_log_files_; 153 --number_active_log_files_;
154 return; 154 return;
155 } 155 }
156 RenderProcessHost* rph = RenderProcessHost::FromID(render_process_id_); 156 RenderProcessHost* rph = RenderProcessHost::FromID(render_process_id_);
157 if (rph) { 157 if (rph) {
158 rph->Send(new PeerConnectionTracker_StartEventLog(peer_connection_local_id, 158 rph->Send(new PeerConnectionTracker_StartEventLog(peer_connection_local_id,
159 file_for_transit)); 159 file_for_transit));
160 } else { 160 } else {
161 --number_active_log_files_; 161 --number_active_log_files_;
162 IPC::PlatformFileForTransitToFile(file_for_transit).Close(); 162 IPC::PlatformFileForTransitToFile(file_for_transit).Close();
163 } 163 }
164 } 164 }
165 165
166 } // namespace content 166 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/tracing/tracing_controller_impl_data_sinks.cc ('k') | content/browser/webui/web_ui_url_loader_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698