Index: third_party/grpc/include/grpc++/create_channel.h |
diff --git a/third_party/WebKit/Source/modules/mediasource/MediaSourceRegistry.cpp b/third_party/grpc/include/grpc++/create_channel.h |
similarity index 54% |
copy from third_party/WebKit/Source/modules/mediasource/MediaSourceRegistry.cpp |
copy to third_party/grpc/include/grpc++/create_channel.h |
index 73f8115ef0ff5317c9f0c0f3e768036afc6981d0..80eed067b7dd55e5cf4dd58db6531444318dd585 100644 |
--- a/third_party/WebKit/Source/modules/mediasource/MediaSourceRegistry.cpp |
+++ b/third_party/grpc/include/grpc++/create_channel.h |
@@ -1,5 +1,7 @@ |
/* |
- * Copyright (C) 2012 Google Inc. All rights reserved. |
+ * |
+ * Copyright 2015-2016, 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,53 +28,45 @@ |
* 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 "modules/mediasource/MediaSourceRegistry.h" |
- |
-#include "modules/mediasource/MediaSource.h" |
-#include "platform/weborigin/KURL.h" |
- |
-namespace blink { |
- |
-MediaSourceRegistry& MediaSourceRegistry::registry() |
-{ |
- ASSERT(isMainThread()); |
- DEFINE_STATIC_LOCAL(MediaSourceRegistry, instance, ()); |
- return instance; |
-} |
+#ifndef GRPCXX_CREATE_CHANNEL_H |
+#define GRPCXX_CREATE_CHANNEL_H |
-void MediaSourceRegistry::registerURL(SecurityOrigin*, const KURL& url, URLRegistrable* registrable) |
-{ |
- ASSERT(®istrable->registry() == this); |
- ASSERT(isMainThread()); |
+#include <memory> |
- MediaSource* source = static_cast<MediaSource*>(registrable); |
- source->addedToRegistry(); |
- m_mediaSources.set(url.getString(), source); |
-} |
+#include <grpc++/channel.h> |
+#include <grpc++/security/credentials.h> |
+#include <grpc++/support/channel_arguments.h> |
+#include <grpc++/support/config.h> |
-void MediaSourceRegistry::unregisterURL(const KURL& url) |
-{ |
- ASSERT(isMainThread()); |
- PersistentHeapHashMap<String, Member<MediaSource>>::iterator iter = m_mediaSources.find(url.getString()); |
- if (iter == m_mediaSources.end()) |
- return; |
+namespace grpc { |
- MediaSource* source = iter->value; |
- m_mediaSources.remove(iter); |
- source->removedFromRegistry(); |
-} |
+/// Create a new \a Channel pointing to \a target |
+/// |
+/// \param target The URI of the endpoint to connect to. |
+/// \param creds Credentials to use for the created channel. If it does not hold |
+/// an object or is invalid, a lame channel is returned. |
+/// \param args Options for channel creation. |
+std::shared_ptr<Channel> CreateChannel( |
+ const grpc::string& target, |
+ const std::shared_ptr<ChannelCredentials>& creds); |
-URLRegistrable* MediaSourceRegistry::lookup(const String& url) |
-{ |
- ASSERT(isMainThread()); |
- return m_mediaSources.get(url); |
-} |
+/// Create a new \em custom \a Channel pointing to \a target |
+/// |
+/// \warning For advanced use and testing ONLY. Override default channel |
+/// arguments only if necessary. |
+/// |
+/// \param target The URI of the endpoint to connect to. |
+/// \param creds Credentials to use for the created channel. If it does not hold |
+/// an object or is invalid, a lame channel is returned. |
+/// \param args Options for channel creation. |
+std::shared_ptr<Channel> CreateCustomChannel( |
+ const grpc::string& target, |
+ const std::shared_ptr<ChannelCredentials>& creds, |
+ const ChannelArguments& args); |
-MediaSourceRegistry::MediaSourceRegistry() |
-{ |
- HTMLMediaSource::setRegistry(this); |
-} |
+} // namespace grpc |
-} // namespace blink |
+#endif // GRPCXX_CREATE_CHANNEL_H |