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 "chromecast/app/cast_main_delegate.h" | 5 #include "chromecast/app/cast_main_delegate.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
54 CastMainDelegate::CastMainDelegate() { | 54 CastMainDelegate::CastMainDelegate() { |
55 } | 55 } |
56 | 56 |
57 CastMainDelegate::~CastMainDelegate() { | 57 CastMainDelegate::~CastMainDelegate() { |
58 } | 58 } |
59 | 59 |
60 bool CastMainDelegate::BasicStartupComplete(int* exit_code) { | 60 bool CastMainDelegate::BasicStartupComplete(int* exit_code) { |
61 RegisterPathProvider(); | 61 RegisterPathProvider(); |
62 | 62 |
63 logging::LoggingSettings settings; | 63 logging::LoggingSettings settings; |
64 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; | |
64 #if defined(OS_ANDROID) | 65 #if defined(OS_ANDROID) |
65 base::FilePath log_file; | |
66 PathService::Get(FILE_CAST_ANDROID_LOG, &log_file); | |
67 settings.logging_dest = logging::LOG_TO_ALL; | |
68 settings.log_file = log_file.value().c_str(); | |
69 const base::CommandLine* command_line(base::CommandLine::ForCurrentProcess()); | 66 const base::CommandLine* command_line(base::CommandLine::ForCurrentProcess()); |
70 std::string process_type = | 67 std::string process_type = |
71 command_line->GetSwitchValueASCII(switches::kProcessType); | 68 command_line->GetSwitchValueASCII(switches::kProcessType); |
72 // Only delete the old logs if the current process is the browser process. | 69 // Browser process logs are recorded for attaching with crash dumps. |
73 // Empty process_type signifies browser process. | 70 if (process_type.empty()) { |
slan
2015/08/21 20:12:14
Could we add a note about permissions explaining w
| |
74 settings.delete_old = process_type.empty() ? logging::DELETE_OLD_LOG_FILE | 71 base::FilePath log_file; |
75 : logging::APPEND_TO_OLD_LOG_FILE; | 72 PathService::Get(FILE_CAST_ANDROID_LOG, &log_file); |
76 #else | 73 settings.logging_dest = logging::LOG_TO_ALL; |
77 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; | 74 settings.log_file = log_file.value().c_str(); |
75 settings.delete_old = logging::DELETE_OLD_LOG_FILE; | |
76 } | |
78 #endif // defined(OS_ANDROID) | 77 #endif // defined(OS_ANDROID) |
79 logging::InitLogging(settings); | 78 logging::InitLogging(settings); |
80 // Time, process, and thread ID are available through logcat. | 79 // Time, process, and thread ID are available through logcat. |
81 logging::SetLogItems(true, true, false, false); | 80 logging::SetLogItems(true, true, false, false); |
82 | 81 |
83 #if defined(OS_ANDROID) | 82 #if defined(OS_ANDROID) |
84 // Only delete the old crash dumps if the current process is the browser | 83 // Only delete the old crash dumps if the current process is the browser |
85 // process. Empty |process_type| signifies browser process. | 84 // process. Empty |process_type| signifies browser process. |
86 if (process_type.empty()) { | 85 if (process_type.empty()) { |
87 // Get a listing of all of the crash dump files. | 86 // Get a listing of all of the crash dump files. |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
229 } | 228 } |
230 | 229 |
231 content::ContentRendererClient* | 230 content::ContentRendererClient* |
232 CastMainDelegate::CreateContentRendererClient() { | 231 CastMainDelegate::CreateContentRendererClient() { |
233 renderer_client_ = CastContentRendererClient::Create(); | 232 renderer_client_ = CastContentRendererClient::Create(); |
234 return renderer_client_.get(); | 233 return renderer_client_.get(); |
235 } | 234 } |
236 | 235 |
237 } // namespace shell | 236 } // namespace shell |
238 } // namespace chromecast | 237 } // namespace chromecast |
OLD | NEW |