0

Remove base::Location::Write.

Change the callers to use Location::ToString() instead.

Write() was mostly to support the profiling web UI which has been removed.

Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: Ie58b4e34b83ef99bffc88d94467fb50ce627818f
Reviewed-on: https://chromium-review.googlesource.com/707310
Reviewed-by: Sky Malice <skym@chromium.org>
Reviewed-by: David Benjamin <davidben@chromium.org>
Commit-Queue: Brett Wilson <brettw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#507498}
This commit is contained in:
Brett Wilson
2017-10-09 21:42:45 +00:00
committed by Commit Bot
parent 0ffff42587
commit 07ec3b5102
6 changed files with 7 additions and 41 deletions

@ -48,24 +48,6 @@ std::string Location::ToString() const {
return StringPrintf("pc:%p", program_counter_);
}
// TODO(brettw) if chrome://profiler is removed, this function can probably
// be removed or merged with ToString.
void Location::Write(bool display_filename, bool display_function_name,
std::string* output) const {
if (has_source_info()) {
StringAppendF(output, "%s[%d] ",
display_filename && file_name_ ? file_name_ : "line",
line_number_);
if (display_function_name && function_name_) {
output->append(function_name_);
output->push_back(' ');
}
} else {
*output = ToString();
}
}
LocationSnapshot::LocationSnapshot() = default;
LocationSnapshot::LocationSnapshot(const Location& location)

@ -64,19 +64,10 @@ class BASE_EXPORT Location {
// nullptr.
const void* program_counter() const { return program_counter_; }
// See Write().
// Converts to the most user-readable form possible. If function and filename
// are not available, this will return "pc:<hex address>".
std::string ToString() const;
// Translate the some of the state in this instance into a human readable
// string with HTML characters in the function names escaped, and append that
// string to |output|. Inclusion of the file_name_ and function_name_ are
// optional, and controlled by the boolean arguments.
//
// If the function and file names are null, the program counter will be
// written.
void Write(bool display_filename, bool display_function_name,
std::string* output) const;
static Location CreateFromHere(const char* file_name);
static Location CreateFromHere(const char* function_name,
const char* file_name,

@ -827,9 +827,7 @@ void ProfileSyncService::OnUnrecoverableErrorImpl(
UMA_HISTOGRAM_ENUMERATION(kSyncUnrecoverableErrorHistogram,
unrecoverable_error_reason_, ERROR_REASON_LIMIT);
std::string location;
from_here.Write(true, true, &location);
LOG(ERROR) << "Unrecoverable error detected at " << location
LOG(ERROR) << "Unrecoverable error detected at " << from_here.ToString()
<< " -- ProfileSyncService unusable: " << message;
// Shut all data types down.

@ -584,11 +584,9 @@ std::unique_ptr<base::DictionaryValue> ConstructAboutInformation(
service->HasUnrecoverableError());
if (service->HasUnrecoverableError()) {
base::Location loc(service->unrecoverable_error_location());
std::string location_str;
loc.Write(true, true, &location_str);
std::string unrecoverable_error_message =
"Unrecoverable error detected at " + location_str + ": " +
"Unrecoverable error detected at " +
service->unrecoverable_error_location().ToString() + ": " +
service->unrecoverable_error_message();
about_info->SetString("unrecoverable_error_message",
unrecoverable_error_message);

@ -45,9 +45,7 @@ void ClearOpenSSLERRStack(const base::Location& location) {
if (error_num == 0)
return;
std::string message;
location.Write(true, true, &message);
DVLOG(1) << "OpenSSL ERR_get_error stack from " << message;
DVLOG(1) << "OpenSSL ERR_get_error stack from " << location.ToString();
ERR_print_errors_cb(&OpenSSLErrorCallback, NULL);
} else {
ERR_clear_error();

@ -230,8 +230,7 @@ class FFmpegDemuxerTest : public testing::Test {
const ReadExpectation& read_expectation,
DemuxerStream::Status status,
const scoped_refptr<DecoderBuffer>& buffer) {
std::string location_str;
location.Write(true, false, &location_str);
std::string location_str = location.ToString();
location_str += "\n";
SCOPED_TRACE(location_str);
EXPECT_EQ(read_expectation.status, status);