Skip to content

Commit 263faa1

Browse files
dennycdHannahShiSFB
authored andcommitted
Native source sync at revision @474418c
1 parent 474418c commit 263faa1

File tree

644 files changed

+10368
-8437
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

644 files changed

+10368
-8437
lines changed

gRPC-C++.podspec

+115-98
Large diffs are not rendered by default.

gRPC-Core.podspec

+174-155
Large diffs are not rendered by default.

gRPC-ProtoRPC.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
Pod::Spec.new do |s|
2323
s.name = 'gRPC-ProtoRPC'
24-
version = '1.70.0-dev'
24+
version = '1.72.0-dev'
2525
s.version = version
2626
s.summary = 'RPC library for Protocol Buffers, based on gRPC'
2727
s.homepage = 'https://grpc.io'

gRPC-RxLibrary.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
Pod::Spec.new do |s|
2323
s.name = 'gRPC-RxLibrary'
24-
version = '1.70.0-dev'
24+
version = '1.72.0-dev'
2525
s.version = version
2626
s.summary = 'Reactive Extensions library for iOS/OSX.'
2727
s.homepage = 'https://grpc.io'

gRPC.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
Pod::Spec.new do |s|
2222
s.name = 'gRPC'
23-
version = '1.70.0-dev'
23+
version = '1.72.0-dev'
2424
s.version = version
2525
s.summary = 'gRPC client library for iOS/OSX'
2626
s.homepage = 'https://grpc.io'

include/grpc/event_engine/endpoint_config.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616

1717
#include <grpc/support/port_platform.h>
1818

19+
#include <optional>
1920
#include <string>
2021

2122
#include "absl/strings/string_view.h"
22-
#include "absl/types/optional.h"
2323

2424
namespace grpc_event_engine {
2525
namespace experimental {
@@ -32,11 +32,11 @@ class EndpointConfig {
3232
public:
3333
virtual ~EndpointConfig() = default;
3434
// If the key points to an integer config, an integer value gets returned.
35-
// Otherwise it returns an absl::nullopt_t
36-
virtual absl::optional<int> GetInt(absl::string_view key) const = 0;
35+
// Otherwise it returns an std::nullopt_t
36+
virtual std::optional<int> GetInt(absl::string_view key) const = 0;
3737
// If the key points to an string config, an string value gets returned.
38-
// Otherwise it returns an absl::nullopt_t
39-
virtual absl::optional<absl::string_view> GetString(
38+
// Otherwise it returns an std::nullopt_t
39+
virtual std::optional<absl::string_view> GetString(
4040
absl::string_view key) const = 0;
4141
// If the key points to an void* config, a void* pointer value gets returned.
4242
// Otherwise it returns nullptr

include/grpc/event_engine/event_engine.h

+44-5
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "absl/status/statusor.h"
2929

3030
// TODO(vigneshbabu): Define the Endpoint::Write metrics collection system
31+
// TODO(hork): remove all references to the factory methods.
3132
namespace grpc_event_engine {
3233
namespace experimental {
3334

@@ -471,7 +472,7 @@ class EventEngine : public std::enable_shared_from_this<EventEngine>,
471472
virtual bool Cancel(TaskHandle handle) = 0;
472473
};
473474

474-
/// Replace gRPC's default EventEngine factory.
475+
/// [DEPRECATED] Replace gRPC's default EventEngine factory.
475476
///
476477
/// Applications may call \a SetEventEngineFactory at any time to replace the
477478
/// default factory used within gRPC. EventEngines will be created when
@@ -480,18 +481,56 @@ class EventEngine : public std::enable_shared_from_this<EventEngine>,
480481
/// To be certain that none of the gRPC-provided built-in EventEngines are
481482
/// created, applications must set a custom EventEngine factory method *before*
482483
/// grpc is initialized.
484+
// TODO(hork): delete once all known users have migrated away
483485
void SetEventEngineFactory(
484-
absl::AnyInvocable<std::unique_ptr<EventEngine>()> factory);
486+
absl::AnyInvocable<std::shared_ptr<EventEngine>()> factory);
485487

486-
/// Reset gRPC's EventEngine factory to the built-in default.
488+
/// [DEPRECATED] Reset gRPC's EventEngine factory to the built-in default.
487489
///
488490
/// Applications that have called \a SetEventEngineFactory can remove their
489491
/// custom factory using this method. The built-in EventEngine factories will be
490492
/// used going forward. This has no affect on any EventEngines that were created
491493
/// using the previous factories.
494+
//
495+
// TODO(hork): delete once all known users have migrated away
492496
void EventEngineFactoryReset();
493-
/// Create an EventEngine using the default factory.
494-
std::unique_ptr<EventEngine> CreateEventEngine();
497+
498+
/// Create a new EventEngine instance.
499+
std::shared_ptr<EventEngine> CreateEventEngine();
500+
501+
/// Set the default EventEngine instance, which will be used throughout gRPC
502+
///
503+
/// gRPC will hold a ref to this engine until either
504+
/// \a ShutdownDefaultEventEngine() is called or \a SetDefaultEventEngine() is
505+
/// called again with a different value. Passing a value of nullptr will cause
506+
/// gRPC to drop the ref it was holding without setting it to a new one.
507+
///
508+
/// Earlier calls to \a GetDefaultEventEngine will still hold a ref to the
509+
/// previous default engine instance, if any.
510+
void SetDefaultEventEngine(std::shared_ptr<EventEngine> engine);
511+
512+
/// Returns the default EventEngine instance.
513+
///
514+
/// Note that if SetDefaultEventEngine() has not been called, then the default
515+
/// EventEngine may be created and destroyed as needed, meaning that multiple
516+
/// calls to GetDefaultEventEngine() over a process's lifetime may return
517+
/// different instances. Callers are expected to call GetDefaultEventEngine()
518+
/// once and hold the returned reference for as long as they need the
519+
/// EventEngine instance.
520+
std::shared_ptr<EventEngine> GetDefaultEventEngine();
521+
522+
/// Resets gRPC to use one of the default internal EventEngines for all *new*
523+
/// \a GetDefaultEventEngine requests and blocks until all refs on the active
524+
/// default engine have been released (destroying that engine).
525+
///
526+
/// If you called \a SetDefaultEventEngine, you must call either
527+
/// \a ShutdownDefaultEventEngine or \a SetDefaultEventEngine(nullptr) at the
528+
/// end of your program. If you don't, the engine will never be destroyed.
529+
///
530+
/// If you want to reset the default engine to one of gRPC's internal versions
531+
/// without waiting for all references to be released on the current default
532+
/// engine, call \a SetDefaultEventEngine(nullptr) instead.
533+
void ShutdownDefaultEventEngine();
495534

496535
bool operator==(const EventEngine::TaskHandle& lhs,
497536
const EventEngine::TaskHandle& rhs);

include/grpc/event_engine/memory_request.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ class MemoryRequest {
5555
template <typename Sink>
5656
friend void AbslStringify(Sink& s, const MemoryRequest& r) {
5757
if (r.min_ == r.max_) {
58-
s.Append(r.min_);
58+
s.Append(std::to_string(r.min_));
5959
} else {
60-
s.Append(r.min_);
60+
s.Append(std::to_string(r.min_));
6161
s.Append("..");
62-
s.Append(r.max_);
62+
s.Append(std::to_string(r.max_));
6363
}
6464
}
6565

include/grpc/status.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ typedef enum {
146146
GRPC_STATUS_DATA_LOSS = 15,
147147

148148
/** Force users to include a default branch: */
149-
GRPC_STATUS__DO_NOT_USE = -1
149+
GRPC_STATUS__DO_NOT_USE = 0x7fffffffu,
150150
} grpc_status_code;
151151

152152
#ifdef __cplusplus

include/grpc/support/json.h

+16-16
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
#include <map>
2424
#include <string>
2525
#include <utility>
26+
#include <variant>
2627
#include <vector>
2728

2829
#include "absl/strings/str_cat.h"
29-
#include "absl/types/variant.h"
3030

3131
namespace grpc_core {
3232
namespace experimental {
@@ -147,46 +147,46 @@ class Json {
147147

148148
// Moveable.
149149
Json(Json&& other) noexcept : value_(std::move(other.value_)) {
150-
other.value_ = absl::monostate();
150+
other.value_ = std::monostate();
151151
}
152152
Json& operator=(Json&& other) noexcept {
153153
value_ = std::move(other.value_);
154-
other.value_ = absl::monostate();
154+
other.value_ = std::monostate();
155155
return *this;
156156
}
157157

158158
// Returns the JSON type.
159159
Type type() const {
160160
struct ValueFunctor {
161-
Json::Type operator()(const absl::monostate&) { return Type::kNull; }
161+
Json::Type operator()(const std::monostate&) { return Type::kNull; }
162162
Json::Type operator()(bool) { return Type::kBoolean; }
163163
Json::Type operator()(const NumberValue&) { return Type::kNumber; }
164164
Json::Type operator()(const std::string&) { return Type::kString; }
165165
Json::Type operator()(const Object&) { return Type::kObject; }
166166
Json::Type operator()(const Array&) { return Type::kArray; }
167167
};
168-
return absl::visit(ValueFunctor(), value_);
168+
return std::visit(ValueFunctor(), value_);
169169
}
170170

171171
// Payload accessor for kBoolean.
172172
// Must not be called for other types.
173-
bool boolean() const { return absl::get<bool>(value_); }
173+
bool boolean() const { return std::get<bool>(value_); }
174174

175175
// Payload accessor for kNumber or kString.
176176
// Must not be called for other types.
177177
const std::string& string() const {
178-
const NumberValue* num = absl::get_if<NumberValue>(&value_);
178+
const NumberValue* num = std::get_if<NumberValue>(&value_);
179179
if (num != nullptr) return num->value;
180-
return absl::get<std::string>(value_);
180+
return std::get<std::string>(value_);
181181
}
182182

183183
// Payload accessor for kObject.
184184
// Must not be called for other types.
185-
const Object& object() const { return absl::get<Object>(value_); }
185+
const Object& object() const { return std::get<Object>(value_); }
186186

187187
// Payload accessor for kArray.
188188
// Must not be called for other types.
189-
const Array& array() const { return absl::get<Array>(value_); }
189+
const Array& array() const { return std::get<Array>(value_); }
190190

191191
bool operator==(const Json& other) const { return value_ == other.value_; }
192192
bool operator!=(const Json& other) const { return !(*this == other); }
@@ -199,12 +199,12 @@ class Json {
199199
return value == other.value;
200200
}
201201
};
202-
using Value = absl::variant<absl::monostate, // kNull
203-
bool, // kBoolean
204-
NumberValue, // kNumber
205-
std::string, // kString
206-
Object, // kObject
207-
Array>; // kArray
202+
using Value = std::variant<std::monostate, // kNull
203+
bool, // kBoolean
204+
NumberValue, // kNumber
205+
std::string, // kString
206+
Object, // kObject
207+
Array>; // kArray
208208

209209
explicit Json(Value value) : value_(std::move(value)) {}
210210

include/grpcpp/ext/call_metric_recorder.h

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include <string>
2727

2828
#include "absl/strings/string_view.h"
29-
#include "absl/types/optional.h"
3029

3130
namespace grpc {
3231
namespace experimental {

include/grpcpp/ports_def.inc

+137
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
/*
2+
*
3+
* Copyright 2025 gRPC authors.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*
17+
* Protect Code from unwanted/inconvienet macros
18+
* you must follow this pattern when #including port_def.inc in a header file:
19+
*
20+
* #include "other_header.h"
21+
* #include "message.h"
22+
* etc.
23+
*
24+
* #include "port_def.inc" // MUST be last header included
25+
*
26+
* Definitions for this header.
27+
*
28+
* #include "port_undef.inc" //At end of file
29+
*
30+
* This is a textual header with no include guard, because we want to
31+
* detect/prohibit anytime it is #included twice without a corresponding
32+
* #undef.
33+
*/
34+
35+
#ifdef GRPC_PORT_
36+
#error "port_def.inc included multiple times"
37+
#endif
38+
#define GRPC_PORT_
39+
40+
41+
// Windows declares several inconvenient macro names. We #undef them and then
42+
// restore them in port_undef.inc.
43+
#ifdef _WIN32
44+
#pragma push_macro("CompareString")
45+
#undef CompareString
46+
#pragma push_macro("CREATE_NEW")
47+
#undef CREATE_NEW
48+
#pragma push_macro("DELETE")
49+
#undef DELETE
50+
#pragma push_macro("DOUBLE_CLICK")
51+
#undef DOUBLE_CLICK
52+
#pragma push_macro("ERROR")
53+
#undef ERROR
54+
#pragma push_macro("ERROR_BUSY")
55+
#undef ERROR_BUSY
56+
#pragma push_macro("ERROR_INSTALL_FAILED")
57+
#undef ERROR_INSTALL_FAILED
58+
#pragma push_macro("ERROR_NOT_FOUND")
59+
#undef ERROR_NOT_FOUND
60+
#pragma push_macro("ERROR_RETRY")
61+
#undef ERROR_RETRY
62+
#pragma push_macro("ERROR_TIMEOUT")
63+
#undef ERROR_TIMEOUT
64+
#pragma push_macro("GetClassName")
65+
#undef GetClassName
66+
#pragma push_macro("GetCurrentTime")
67+
#undef GetCurrentTime
68+
#pragma push_macro("GetMessage")
69+
#undef GetMessage
70+
#pragma push_macro("GetObject")
71+
#undef GetObject
72+
#pragma push_macro("IGNORE")
73+
#undef IGNORE
74+
#pragma push_macro("IN")
75+
#undef IN
76+
#pragma push_macro("INPUT_KEYBOARD")
77+
#undef INPUT_KEYBOARD
78+
#pragma push_macro("NO_ERROR")
79+
#undef NO_ERROR
80+
#pragma push_macro("OUT")
81+
#undef OUT
82+
#pragma push_macro("OPTIONAL")
83+
#undef OPTIONAL
84+
#pragma push_macro("min")
85+
#undef min
86+
#pragma push_macro("max")
87+
#undef max
88+
#pragma push_macro("NEAR")
89+
#undef NEAR
90+
#pragma push_macro("NO_DATA")
91+
#undef NO_DATA
92+
#pragma push_macro("REASON_UNKNOWN")
93+
#undef REASON_UNKNOWN
94+
#pragma push_macro("SERVICE_DISABLED")
95+
#undef SERVICE_DISABLED
96+
#pragma push_macro("SERVICE_STOP")
97+
#undef SERVICE_STOP
98+
#pragma push_macro("SEVERITY_ERROR")
99+
#undef SEVERITY_ERROR
100+
#pragma push_macro("STATUS_PENDING")
101+
#undef STATUS_PENDING
102+
#pragma push_macro("STRICT")
103+
#undef STRICT
104+
#pragma push_macro("timezone")
105+
#undef timezone
106+
#pragma push_macro("TRUE")
107+
#undef TRUE
108+
#pragma push_macro("FALSE")
109+
#undef FALSE
110+
#pragma push_macro("UNICODE")
111+
#undef UNICODE
112+
#endif // _WIN32
113+
114+
#ifdef __APPLE__
115+
// Inconvenient macro names from /usr/include/mach/boolean.h in some macOS SDKs.
116+
#pragma push_macro("TRUE")
117+
#undef TRUE
118+
#pragma push_macro("FALSE")
119+
#undef FALSE
120+
// Inconvenient macro names from usr/include/sys/syslimits.h in some macOS SDKs.
121+
#pragma push_macro("UID_MAX")
122+
#undef UID_MAX
123+
#pragma push_macro("GID_MAX")
124+
#undef GID_MAX
125+
// TYPE_BOOL is defined in the MacOS's ConditionalMacros.h.
126+
#pragma push_macro("TYPE_BOOL")
127+
#undef TYPE_BOOL
128+
#endif // __APPLE__
129+
130+
#if defined(ANDROID) || defined(__ANDROID__)
131+
// Inconvenient macro names from usr/include/limits.h in some Android NDKs.
132+
#pragma push_macro("UID_MAX")
133+
#undef UID_MAX
134+
#pragma push_macro("GID_MAX")
135+
#undef GID_MAX
136+
#endif // defined(ANDROID) || defined(__ANDROID__)
137+

0 commit comments

Comments
 (0)