Commit 441e1ab9 authored by Dominic Battre's avatar Dominic Battre Committed by Commit Bot

Move log_buffer.* from browser/ to common/

This CL moves the log_buffer.* implementation from browser/ to common/. This
allows the LogBuffer to be used for structures that live in common and in
the renderer.

Bug: 928595
Change-Id: Ib249f88c997a3669008efad1a99240fe6d0d2cbc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1804299Reviewed-by: default avatarVadym Doroshenko <dvadym@chromium.org>
Commit-Queue: Dominic Battré <battre@chromium.org>
Cr-Commit-Position: refs/heads/master@{#697159}
parent c35ee668
...@@ -145,12 +145,11 @@ jumbo_static_library("browser") { ...@@ -145,12 +145,11 @@ jumbo_static_library("browser") {
"geo/state_names.h", "geo/state_names.h",
"geo/subkey_requester.cc", "geo/subkey_requester.cc",
"geo/subkey_requester.h", "geo/subkey_requester.h",
"logging/log_buffer.cc",
"logging/log_buffer.h",
"logging/log_buffer_submitter.cc", "logging/log_buffer_submitter.cc",
"logging/log_buffer_submitter.h", "logging/log_buffer_submitter.h",
"logging/log_manager.cc", "logging/log_manager.cc",
"logging/log_manager.h", "logging/log_manager.h",
"logging/log_protobufs.h",
"logging/log_receiver.h", "logging/log_receiver.h",
"logging/log_router.cc", "logging/log_router.cc",
"logging/log_router.h", "logging/log_router.h",
...@@ -565,7 +564,6 @@ source_set("unit_tests") { ...@@ -565,7 +564,6 @@ source_set("unit_tests") {
"geo/phone_number_i18n_unittest.cc", "geo/phone_number_i18n_unittest.cc",
"geo/subkey_requester_unittest.cc", "geo/subkey_requester_unittest.cc",
"logging/log_buffer_submitter_unittest.cc", "logging/log_buffer_submitter_unittest.cc",
"logging/log_buffer_unittest.cc",
"logging/log_manager_unittest.cc", "logging/log_manager_unittest.cc",
"logging/log_router_unittest.cc", "logging/log_router_unittest.cc",
"payments/credit_card_access_manager_unittest.cc", "payments/credit_card_access_manager_unittest.cc",
......
...@@ -28,8 +28,8 @@ ...@@ -28,8 +28,8 @@
#include "components/autofill/core/browser/autofill_internals_service.h" #include "components/autofill/core/browser/autofill_internals_service.h"
#include "components/autofill/core/browser/autofill_metrics.h" #include "components/autofill/core/browser/autofill_metrics.h"
#include "components/autofill/core/browser/form_structure.h" #include "components/autofill/core/browser/form_structure.h"
#include "components/autofill/core/browser/logging/log_buffer.h"
#include "components/autofill/core/browser/logging/log_manager.h" #include "components/autofill/core/browser/logging/log_manager.h"
#include "components/autofill/core/browser/logging/log_protobufs.h"
#include "components/autofill/core/browser/proto/legacy_proto_bridge.h" #include "components/autofill/core/browser/proto/legacy_proto_bridge.h"
#include "components/autofill/core/browser/proto/server.pb.h" #include "components/autofill/core/browser/proto/server.pb.h"
#include "components/autofill/core/common/autofill_clock.h" #include "components/autofill/core/common/autofill_clock.h"
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include "components/autofill/core/common/autofill_internals/logging_scope.h" #include "components/autofill/core/common/autofill_internals/logging_scope.h"
#include "components/autofill/core/common/autofill_prefs.h" #include "components/autofill/core/common/autofill_prefs.h"
#include "components/autofill/core/common/autofill_switches.h" #include "components/autofill/core/common/autofill_switches.h"
#include "components/autofill/core/common/logging/log_buffer.h"
#include "components/autofill/core/common/mojom/autofill_types.mojom.h" #include "components/autofill/core/common/mojom/autofill_types.mojom.h"
#include "components/google/core/common/google_util.h" #include "components/google/core/common/google_util.h"
#include "components/history/core/browser/history_service.h" #include "components/history/core/browser/history_service.h"
......
...@@ -6,10 +6,10 @@ ...@@ -6,10 +6,10 @@
#define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_INTERNALS_SERVICE_H_ #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_INTERNALS_SERVICE_H_
#include "base/macros.h" #include "base/macros.h"
#include "components/autofill/core/browser/logging/log_buffer.h"
#include "components/autofill/core/browser/logging/log_router.h" #include "components/autofill/core/browser/logging/log_router.h"
#include "components/autofill/core/common/autofill_internals/log_message.h" #include "components/autofill/core/common/autofill_internals/log_message.h"
#include "components/autofill/core/common/autofill_internals/logging_scope.h" #include "components/autofill/core/common/autofill_internals/logging_scope.h"
#include "components/autofill/core/common/logging/log_buffer.h"
namespace autofill { namespace autofill {
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
#include "components/autofill/core/browser/field_types.h" #include "components/autofill/core/browser/field_types.h"
#include "components/autofill/core/browser/form_parsing/field_candidates.h" #include "components/autofill/core/browser/form_parsing/field_candidates.h"
#include "components/autofill/core/browser/form_parsing/form_field.h" #include "components/autofill/core/browser/form_parsing/form_field.h"
#include "components/autofill/core/browser/logging/log_buffer.h"
#include "components/autofill/core/browser/proto/legacy_proto_bridge.h" #include "components/autofill/core/browser/proto/legacy_proto_bridge.h"
#include "components/autofill/core/browser/randomized_encoder.h" #include "components/autofill/core/browser/randomized_encoder.h"
#include "components/autofill/core/browser/rationalization_util.h" #include "components/autofill/core/browser/rationalization_util.h"
...@@ -50,6 +49,7 @@ ...@@ -50,6 +49,7 @@
#include "components/autofill/core/common/form_data_predictions.h" #include "components/autofill/core/common/form_data_predictions.h"
#include "components/autofill/core/common/form_field_data.h" #include "components/autofill/core/common/form_field_data.h"
#include "components/autofill/core/common/form_field_data_predictions.h" #include "components/autofill/core/common/form_field_data_predictions.h"
#include "components/autofill/core/common/logging/log_buffer.h"
#include "components/autofill/core/common/signatures_util.h" #include "components/autofill/core/common/signatures_util.h"
#include "components/security_state/core/security_state.h" #include "components/security_state/core/security_state.h"
#include "url/origin.h" #include "url/origin.h"
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#define COMPONENTS_AUTOFILL_CORE_BROWSER_LOGGING_LOG_BUFFER_SUBMITTER_H_ #define COMPONENTS_AUTOFILL_CORE_BROWSER_LOGGING_LOG_BUFFER_SUBMITTER_H_
#include "base/macros.h" #include "base/macros.h"
#include "components/autofill/core/browser/logging/log_buffer.h" #include "components/autofill/core/common/logging/log_buffer.h"
namespace autofill { namespace autofill {
......
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_LOGGING_LOG_PROTOBUFS_H_
#define COMPONENTS_AUTOFILL_CORE_BROWSER_LOGGING_LOG_PROTOBUFS_H_
#include "components/autofill/core/common/logging/log_buffer.h"
#include "third_party/protobuf/src/google/protobuf/repeated_field.h"
namespace autofill {
// Serialize a repeated field in a protobuf. This function is not part of
// log_buffer.h because that would create a dependency of the renderer process
// to protobufs.
template <typename T>
LogBuffer& operator<<(LogBuffer& buf,
const ::google::protobuf::RepeatedField<T>& values) {
buf << "[";
for (int i = 0; i < values.size(); ++i) {
if (i)
buf << ", ";
buf << values.Get(i);
}
buf << "]";
return buf;
}
} // namespace autofill
#endif // COMPONENTS_AUTOFILL_CORE_BROWSER_LOGGING_LOG_PROTOBUFS_H_
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
#include "base/stl_util.h" #include "base/stl_util.h"
#include "base/strings/string_split.h" #include "base/strings/string_split.h"
#include "components/autofill/core/browser/logging/log_buffer.h"
#include "components/autofill/core/browser/logging/log_manager.h" #include "components/autofill/core/browser/logging/log_manager.h"
#include "components/autofill/core/browser/logging/log_receiver.h" #include "components/autofill/core/browser/logging/log_receiver.h"
#include "components/autofill/core/common/logging/log_buffer.h"
#include "net/base/escape.h" #include "net/base/escape.h"
namespace autofill { namespace autofill {
......
...@@ -39,6 +39,8 @@ jumbo_static_library("common") { ...@@ -39,6 +39,8 @@ jumbo_static_library("common") {
"form_field_data.h", "form_field_data.h",
"form_field_data_predictions.cc", "form_field_data_predictions.cc",
"form_field_data_predictions.h", "form_field_data_predictions.h",
"logging/log_buffer.cc",
"logging/log_buffer.h",
"password_form.cc", "password_form.cc",
"password_form.h", "password_form.h",
"password_form_field_prediction_map.h", "password_form_field_prediction_map.h",
...@@ -81,6 +83,7 @@ source_set("unit_tests") { ...@@ -81,6 +83,7 @@ source_set("unit_tests") {
"autofill_util_unittest.cc", "autofill_util_unittest.cc",
"form_data_unittest.cc", "form_data_unittest.cc",
"form_field_data_unittest.cc", "form_field_data_unittest.cc",
"logging/log_buffer_unittest.cc",
"password_form_fill_data_unittest.cc", "password_form_fill_data_unittest.cc",
"save_password_progress_logger_unittest.cc", "save_password_progress_logger_unittest.cc",
] ]
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "components/autofill/core/browser/logging/log_buffer.h" #include "components/autofill/core/common/logging/log_buffer.h"
#include <string> #include <string>
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_LOGGING_LOG_BUFFER_H_ #ifndef COMPONENTS_AUTOFILL_CORE_COMMON_LOGGING_LOG_BUFFER_H_
#define COMPONENTS_AUTOFILL_CORE_BROWSER_LOGGING_LOG_BUFFER_H_ #define COMPONENTS_AUTOFILL_CORE_COMMON_LOGGING_LOG_BUFFER_H_
#include <string> #include <string>
#include <type_traits> #include <type_traits>
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/strings/string_piece.h" #include "base/strings/string_piece.h"
#include "base/values.h" #include "base/values.h"
#include "third_party/protobuf/src/google/protobuf/repeated_field.h"
#include "url/gurl.h" #include "url/gurl.h"
// The desired pattern to generate log messages is to pass a scope, a log // The desired pattern to generate log messages is to pass a scope, a log
...@@ -153,19 +152,6 @@ LogBuffer& operator<<(LogBuffer& buf, LogBuffer&& buffer); ...@@ -153,19 +152,6 @@ LogBuffer& operator<<(LogBuffer& buf, LogBuffer&& buffer);
// reasons. // reasons.
LogBuffer& operator<<(LogBuffer& buf, const GURL& url); LogBuffer& operator<<(LogBuffer& buf, const GURL& url);
template <typename T>
LogBuffer& operator<<(LogBuffer& buf,
const ::google::protobuf::RepeatedField<T>& values) {
buf << "[";
for (int i = 0; i < values.size(); ++i) {
if (i)
buf << ", ";
buf << values.Get(i);
}
buf << "]";
return buf;
}
template <typename T> template <typename T>
LogBuffer& operator<<(LogBuffer& buf, const std::vector<T>& values) { LogBuffer& operator<<(LogBuffer& buf, const std::vector<T>& values) {
buf << "["; buf << "[";
...@@ -219,4 +205,4 @@ LogBuffer HighlightValue(base::StringPiece16 haystack, ...@@ -219,4 +205,4 @@ LogBuffer HighlightValue(base::StringPiece16 haystack,
} // namespace autofill } // namespace autofill
#endif // COMPONENTS_AUTOFILL_CORE_BROWSER_LOGGING_LOG_BUFFER_H_ #endif // COMPONENTS_AUTOFILL_CORE_COMMON_LOGGING_LOG_BUFFER_H_
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "components/autofill/core/browser/logging/log_buffer.h" #include "components/autofill/core/common/logging/log_buffer.h"
#include "base/json/json_writer.h" #include "base/json/json_writer.h"
#include "base/strings/string_piece.h" #include "base/strings/string_piece.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment