1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
media / base / media_log_events.cc [blame]
// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/base/media_log_events.h"
#include <string>
#include "base/notreached.h"
namespace media {
std::string TruncateUrlString(const std::string& url) {
if (url.length() > kMaxUrlLength) {
// Take substring and _then_ replace, to avoid copying unused data.
return url.substr(0, kMaxUrlLength)
.replace(kMaxUrlLength - 3, kMaxUrlLength, "...");
}
return url;
}
} // namespace media