| Index: third_party/grpc/src/core/client_config/resolver_registry.h
|
| diff --git a/third_party/WebKit/Source/platform/text/BidiTextRun.cpp b/third_party/grpc/src/core/client_config/resolver_registry.h
|
| similarity index 50%
|
| copy from third_party/WebKit/Source/platform/text/BidiTextRun.cpp
|
| copy to third_party/grpc/src/core/client_config/resolver_registry.h
|
| index 99834e255c84f138dcd8bb3e91b276da61516a49..5a7193b7ae258ace3cda801f1699378423f2243c 100644
|
| --- a/third_party/WebKit/Source/platform/text/BidiTextRun.cpp
|
| +++ b/third_party/grpc/src/core/client_config/resolver_registry.h
|
| @@ -1,5 +1,7 @@
|
| /*
|
| - * Copyright (C) 2013 Google Inc. All rights reserved.
|
| + *
|
| + * Copyright 2015, Google Inc.
|
| + * All rights reserved.
|
| *
|
| * Redistribution and use in source and binary forms, with or without
|
| * modification, are permitted provided that the following conditions are
|
| @@ -26,47 +28,38 @@
|
| * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| + *
|
| */
|
|
|
| -#include "platform/text/BidiTextRun.h"
|
| -
|
| -#include "platform/text/BidiResolver.h"
|
| -#include "platform/text/TextRunIterator.h"
|
| -
|
| -namespace blink {
|
| -
|
| -TextDirection directionForRun(TextRun& run, bool* hasStrongDirectionality)
|
| -{
|
| - if (!hasStrongDirectionality) {
|
| - // 8bit is Latin-1 and therefore is always LTR.
|
| - if (run.is8Bit())
|
| - return LTR;
|
| +#ifndef GRPC_INTERNAL_CORE_CLIENT_CONFIG_RESOLVER_REGISTRY_H
|
| +#define GRPC_INTERNAL_CORE_CLIENT_CONFIG_RESOLVER_REGISTRY_H
|
|
|
| - // length == 1 for more than 90% of cases of width() for CJK text.
|
| - if (run.length() == 1 && U16_IS_SINGLE(run.characters16()[0]))
|
| - return directionForCharacter(run.characters16()[0]);
|
| - }
|
| +#include "src/core/client_config/resolver_factory.h"
|
|
|
| - BidiResolver<TextRunIterator, BidiCharacterRun> bidiResolver;
|
| - bidiResolver.setStatus(BidiStatus(run.direction(), run.directionalOverride()));
|
| - bidiResolver.setPositionIgnoringNestedIsolates(TextRunIterator(&run, 0));
|
| - return bidiResolver.determineDirectionality(hasStrongDirectionality);
|
| -}
|
| +void grpc_resolver_registry_init(const char *default_prefix);
|
| +void grpc_resolver_registry_shutdown(void);
|
|
|
| -TextDirection determineDirectionality(const String& value, bool* hasStrongDirectionality)
|
| -{
|
| - TextRun run(value);
|
| - return directionForRun(run, hasStrongDirectionality);
|
| -}
|
| +/** Register a resolver type.
|
| + URI's of \a scheme will be resolved with the given resolver.
|
| + If \a priority is greater than zero, then the resolver will be eligible
|
| + to resolve names that are passed in with no scheme. Higher priority
|
| + resolvers will be tried before lower priority schemes. */
|
| +void grpc_register_resolver_type(grpc_resolver_factory *factory);
|
|
|
| -TextRun textRunWithDirectionality(const String& value, bool* hasStrongDirectionality)
|
| -{
|
| - TextRun run(value);
|
| - TextDirection direction = directionForRun(run, hasStrongDirectionality);
|
| - if (hasStrongDirectionality)
|
| - run.setDirection(direction);
|
| - return run;
|
| -}
|
| +/** Create a resolver given \a target.
|
| + First tries to parse \a target as a URI. If this succeeds, tries
|
| + to locate a registered resolver factory based on the URI scheme.
|
| + If parsing or location fails, prefixes default_prefix from
|
| + grpc_resolver_registry_init to target, and tries again (if default_prefix
|
| + was not NULL).
|
| + If a resolver factory was found, use it to instantiate a resolver and
|
| + return it.
|
| + If a resolver factory was not found, return NULL. */
|
| +grpc_resolver *grpc_resolver_create(
|
| + const char *target, grpc_subchannel_factory *subchannel_factory);
|
|
|
| -} // namespace blink
|
| +/** Given a target, return a (freshly allocated with gpr_malloc) string
|
| + representing the default authority to pass from a client. */
|
| +char *grpc_get_default_authority(const char *target);
|
|
|
| +#endif /* GRPC_INTERNAL_CORE_CLIENT_CONFIG_RESOLVER_REGISTRY_H */
|
|
|