1From 9d210ed05abf5e527f1de0b30fff62a8a3ae548f Mon Sep 17 00:00:00 2001
2From: hscham <[email protected]>
3Date: Mon, 13 Apr 2020 10:36:11 +0900
4Subject: [PATCH] libchrome: r680000 forward compatibility patch part 1
5
6This CL includes:
7- Add header files base/hash/{hash,md5,sha1}.h and
8  base/system/sys_info.h from base/.
9- Add macro PRFilePath.
10- Add JSONReader::{Read,ReadAndReturnError,ReadToValue}Deprecated, alias
11  of the corresponding method without the Deprecated suffix.
12- Add empty class base::CheckedObserver.
13- Add bool operators == and != for base::RepeatingCallback.
14- ScopedClearLastError (up to r758621)
15
16Change-Id: I6ba15f2938c02729e4fd51e5a4a52cb94e7c2a4e
17---
18 base/callback.h            |  8 ++++++++
19 base/files/file_path.h     |  1 +
20 base/hash/hash.h           |  8 ++++++++
21 base/hash/md5.h            | 10 ++++++++++
22 base/hash/sha1.h           | 10 ++++++++++
23 base/json/json_reader.h    | 19 +++++++++++++++++++
24 base/observer_list_types.h | 24 ++++++++++++++++++++++++
25 base/system/sys_info.h     | 10 ++++++++++
26 8 files changed, 90 insertions(+)
27 create mode 100644 base/hash/hash.h
28 create mode 100644 base/hash/md5.h
29 create mode 100644 base/hash/sha1.h
30 create mode 100644 base/observer_list_types.h
31 create mode 100644 base/system/sys_info.h
32
33diff --git a/base/callback.h b/base/callback.h
34index bcda5af58..22a6f0e3e 100644
35--- a/base/callback.h
36+++ b/base/callback.h
37@@ -123,6 +123,14 @@ class RepeatingCallback<R(Args...)> : public internal::CallbackBaseCopyable {
38     return EqualsInternal(other);
39   }
40
41+  bool operator==(const RepeatingCallback& other) const {
42+    return EqualsInternal(other);
43+  }
44+
45+  bool operator!=(const RepeatingCallback& other) const {
46+    return !operator==(other);
47+  }
48+
49   R Run(Args... args) const & {
50     PolymorphicInvoke f =
51         reinterpret_cast<PolymorphicInvoke>(this->polymorphic_invoke());
52diff --git a/base/files/file_path.h b/base/files/file_path.h
53index 2dc15f9d0..36229979d 100644
54--- a/base/files/file_path.h
55+++ b/base/files/file_path.h
56@@ -131,6 +131,7 @@
57 #define PRIsFP "ls"
58 #elif defined(OS_POSIX) || defined(OS_FUCHSIA)
59 #define PRIsFP "s"
60+#define PRFilePath "s"
61 #endif  // OS_WIN
62
63 namespace base {
64diff --git a/base/hash/hash.h b/base/hash/hash.h
65new file mode 100644
66index 000000000..b35a96fd3
67--- /dev/null
68+++ b/base/hash/hash.h
69@@ -0,0 +1,8 @@
70+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
71+// Use of this source code is governed by a BSD-style license that can be
72+// found in the LICENSE file.
73+
74+#ifndef BASE_HASH_HASH_H_
75+#define BASE_HASH_HASH_H_
76+#include "base/hash.h"
77+#endif  // BASE_HASH_HASH_H_
78diff --git a/base/hash/md5.h b/base/hash/md5.h
79new file mode 100644
80index 000000000..821649319
81--- /dev/null
82+++ b/base/hash/md5.h
83@@ -0,0 +1,10 @@
84+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
85+// Use of this source code is governed by a BSD-style license that can be
86+// found in the LICENSE file.
87+
88+#ifndef BASE_HASH_MD5_H_
89+#define BASE_HASH_MD5_H_
90+
91+#include "base/md5.h"
92+
93+#endif  // BASE_HASH_MD5_H_
94diff --git a/base/hash/sha1.h b/base/hash/sha1.h
95new file mode 100644
96index 000000000..7d3e18212
97--- /dev/null
98+++ b/base/hash/sha1.h
99@@ -0,0 +1,10 @@
100+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
101+// Use of this source code is governed by a BSD-style license that can be
102+// found in the LICENSE file.
103+
104+#ifndef BASE_HASH_SHA1_H_
105+#define BASE_HASH_SHA1_H_
106+
107+#include "base/sha1.h"
108+
109+#endif  // BASE_HASH_SHA1_H_
110diff --git a/base/json/json_reader.h b/base/json/json_reader.h
111index 2c6bd3e47..05de907ce 100644
112--- a/base/json/json_reader.h
113+++ b/base/json/json_reader.h
114@@ -98,6 +98,12 @@ class BASE_EXPORT JSONReader {
115   static std::unique_ptr<Value> Read(StringPiece json,
116                                      int options = JSON_PARSE_RFC,
117                                      int max_depth = kStackMaxDepth);
118+  inline static std::unique_ptr<Value> ReadDeprecated(
119+      StringPiece json,
120+      int options = JSON_PARSE_RFC,
121+      int max_depth = kStackMaxDepth){
122+    return Read(json, options, max_depth);
123+  }
124
125   // Reads and parses |json| like Read(). |error_code_out| and |error_msg_out|
126   // are optional. If specified and nullptr is returned, they will be populated
127@@ -110,6 +116,16 @@ class BASE_EXPORT JSONReader {
128       std::string* error_msg_out,
129       int* error_line_out = nullptr,
130       int* error_column_out = nullptr);
131+  inline static std::unique_ptr<Value> ReadAndReturnErrorDeprecated(
132+      StringPiece json,
133+      int options,  // JSONParserOptions
134+      int* error_code_out,
135+      std::string* error_msg_out,
136+      int* error_line_out = nullptr,
137+      int* error_column_out = nullptr){
138+    return ReadAndReturnError(json, options, error_code_out, error_msg_out,
139+                              error_line_out, error_column_out);
140+  }
141
142   // Converts a JSON parse error code into a human readable message.
143   // Returns an empty string if error_code is JSON_NO_ERROR.
144@@ -117,6 +133,9 @@ class BASE_EXPORT JSONReader {
145
146   // Non-static version of Read() above.
147   std::unique_ptr<Value> ReadToValue(StringPiece json);
148+  inline std::unique_ptr<Value> ReadToValueDeprecated(StringPiece json) {
149+    return JSONReader::ReadToValue(json);
150+  }
151
152   // Returns the error code if the last call to ReadToValue() failed.
153   // Returns JSON_NO_ERROR otherwise.
154diff --git a/base/observer_list_types.h b/base/observer_list_types.h
155new file mode 100644
156index 000000000..8f3889735
157--- /dev/null
158+++ b/base/observer_list_types.h
159@@ -0,0 +1,24 @@
160+// Copyright 2018 The Chromium Authors. All rights reserved.
161+// Use of this source code is governed by a BSD-style license that can be
162+// found in the LICENSE file.
163+
164+#ifndef BASE_OBSERVER_LIST_TYPES_H_
165+#define BASE_OBSERVER_LIST_TYPES_H_
166+
167+#include "base/base_export.h"
168+#include "base/macros.h"
169+
170+namespace base {
171+class BASE_EXPORT CheckedObserver {
172+ public:
173+  CheckedObserver() {};
174+
175+ protected:
176+  virtual ~CheckedObserver() = default;
177+
178+  DISALLOW_COPY_AND_ASSIGN(CheckedObserver);
179+};
180+
181+}  // namespace base
182+
183+#endif  // BASE_OBSERVER_LIST_TYPES_H_
184diff --git a/base/scoped_clear_last_error.h b/base/scoped_clear_last_error.h
185new file mode 100644
186index 0000000..066730d
187--- /dev/null
188+++ b/base/scoped_clear_last_error.h
189@@ -0,0 +1,14 @@
190+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
191+// Use of this source code is governed by a BSD-style license that can be
192+// found in the LICENSE file.
193+
194+#ifndef BASE_SCOPED_CLEAR_LAST_ERROR_H_
195+#define BASE_SCOPED_CLEAR_LAST_ERROR_H_
196+
197+#include "base/scoped_clear_errno.h"
198+
199+namespace base {
200+using ScopedClearLastError = base::ScopedClearErrno;
201+}
202+
203+#endif  // BASE_SCOPED_CLEAR_LAST_ERROR_H_
204diff --git a/base/system/sys_info.h b/base/system/sys_info.h
205new file mode 100644
206index 000000000..60676e0e1
207--- /dev/null
208+++ b/base/system/sys_info.h
209@@ -0,0 +1,10 @@
210+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
211+// Use of this source code is governed by a BSD-style license that can be
212+// found in the LICENSE file.
213+
214+#ifndef BASE_SYSTEM_SYS_INFO_H_
215+#define BASE_SYSTEM_SYS_INFO_H_
216+
217+#include "base/sys_info.h"
218+
219+#endif  // BASE_SYSTEM_SYS_INFO_H_
220--
2212.26.1.301.g55bc3eb7cb9-goog
222
223