summaryrefslogtreecommitdiffstats
path: root/security/sandbox/chromium-shim/patches/with_update/revert_Token_serialization_and_deserialization.patch
blob: c2d96dda7841603600915f9962070ff5da578c7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# HG changeset patch
# User Toshihito Kikuchi <tkikuchi@mozilla.com>
# Date 1588530677 25200
#      Sun May 03 11:31:17 2020 -0700
# Node ID a18431660425e41c26c716413aac0294987c985a
# Parent  e149b1937231ccc3c1c07f45acf0e7e71117854f
Revert chromium's ffe1d0eb42d1d75f2b6a3b4145eff69f235a19ee. r=bobowen

Undoing the following commit as it brings more dependency but unused in our code.
https://chromium.googlesource.com/chromium/src.git/+/ffe1d0eb42d1d75f2b6a3b4145eff69f235a19ee

diff --git a/security/sandbox/chromium/base/token.cc b/security/sandbox/chromium/base/token.cc
--- a/security/sandbox/chromium/base/token.cc
+++ b/security/sandbox/chromium/base/token.cc
@@ -1,17 +1,16 @@
 // Copyright 2018 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.
 
 #include "base/token.h"
 
 #include <inttypes.h>
 
-#include "base/pickle.h"
 #include "base/rand_util.h"
 #include "base/strings/stringprintf.h"
 
 namespace base {
 
 // static
 Token Token::CreateRandom() {
   Token token;
@@ -21,26 +20,9 @@ Token Token::CreateRandom() {
   base::RandBytes(&token, sizeof(token));
   return token;
 }
 
 std::string Token::ToString() const {
   return base::StringPrintf("%016" PRIX64 "%016" PRIX64, high_, low_);
 }
 
-void WriteTokenToPickle(Pickle* pickle, const Token& token) {
-  pickle->WriteUInt64(token.high());
-  pickle->WriteUInt64(token.low());
-}
-
-Optional<Token> ReadTokenFromPickle(PickleIterator* pickle_iterator) {
-  uint64_t high;
-  if (!pickle_iterator->ReadUInt64(&high))
-    return nullopt;
-
-  uint64_t low;
-  if (!pickle_iterator->ReadUInt64(&low))
-    return nullopt;
-
-  return Token(high, low);
-}
-
 }  // namespace base
diff --git a/security/sandbox/chromium/base/token.h b/security/sandbox/chromium/base/token.h
--- a/security/sandbox/chromium/base/token.h
+++ b/security/sandbox/chromium/base/token.h
@@ -7,17 +7,16 @@
 
 #include <stdint.h>
 
 #include <iosfwd>
 #include <tuple>
 
 #include "base/base_export.h"
 #include "base/hash/hash.h"
-#include "base/optional.h"
 
 namespace base {
 
 // A Token is a randomly chosen 128-bit integer. This class supports generation
 // from a cryptographically strong random source, or constexpr construction over
 // fixed values (e.g. to store a pre-generated constant value). Tokens are
 // similar in spirit and purpose to UUIDs, without many of the constraints and
 // expectations (such as byte layout and string representation) clasically
@@ -63,19 +62,11 @@ class BASE_EXPORT Token {
 
 // For use in std::unordered_map.
 struct TokenHash {
   size_t operator()(const base::Token& token) const {
     return base::HashInts64(token.high(), token.low());
   }
 };
 
-class Pickle;
-class PickleIterator;
-
-// For serializing and deserializing Token values.
-BASE_EXPORT void WriteTokenToPickle(Pickle* pickle, const Token& token);
-BASE_EXPORT Optional<Token> ReadTokenFromPickle(
-    PickleIterator* pickle_iterator);
-
 }  // namespace base
 
 #endif  // BASE_TOKEN_H_