3 * Copyright 2015 gRPC authors.
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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include <grpc/support/port_platform.h>
21 #include "src/core/ext/filters/client_channel/resolver.h"
23 grpc_core::DebugOnlyTraceFlag grpc_trace_resolver_refcount(false,
32 Resolver::Resolver(std::shared_ptr<WorkSerializer> work_serializer,
33 std::unique_ptr<ResultHandler> result_handler)
34 : InternallyRefCounted(&grpc_trace_resolver_refcount),
35 work_serializer_(std::move(work_serializer)),
36 result_handler_(std::move(result_handler)) {}
42 Resolver::Result::~Result() {
43 GRPC_ERROR_UNREF(service_config_error);
44 grpc_channel_args_destroy(args);
47 Resolver::Result::Result(const Result& other) {
48 addresses = other.addresses;
49 service_config = other.service_config;
50 service_config_error = GRPC_ERROR_REF(other.service_config_error);
51 args = grpc_channel_args_copy(other.args);
54 Resolver::Result::Result(Result&& other) noexcept {
55 addresses = std::move(other.addresses);
56 service_config = std::move(other.service_config);
57 service_config_error = other.service_config_error;
58 other.service_config_error = GRPC_ERROR_NONE;
63 Resolver::Result& Resolver::Result::operator=(const Result& other) {
64 addresses = other.addresses;
65 service_config = other.service_config;
66 GRPC_ERROR_UNREF(service_config_error);
67 service_config_error = GRPC_ERROR_REF(other.service_config_error);
68 grpc_channel_args_destroy(args);
69 args = grpc_channel_args_copy(other.args);
73 Resolver::Result& Resolver::Result::operator=(Result&& other) noexcept {
74 addresses = std::move(other.addresses);
75 service_config = std::move(other.service_config);
76 GRPC_ERROR_UNREF(service_config_error);
77 service_config_error = other.service_config_error;
78 other.service_config_error = GRPC_ERROR_NONE;
79 grpc_channel_args_destroy(args);
85 } // namespace grpc_core