| Index: content/browser/streams/stream_registry.cc
|
| diff --git a/content/browser/streams/stream_registry.cc b/content/browser/streams/stream_registry.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..dfc2021d50e065f3998ba415bee88f95df4e5fa9
|
| --- /dev/null
|
| +++ b/content/browser/streams/stream_registry.cc
|
| @@ -0,0 +1,44 @@
|
| +// Copyright (c) 2013 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 "content/browser/streams/stream_registry.h"
|
| +
|
| +#include <string>
|
| +
|
| +#include "base/guid.h"
|
| +#include "base/stl_util.h"
|
| +#include "base/string_number_conversions.h"
|
| +#include "content/browser/streams/stream.h"
|
| +#include "content/public/common/url_constants.h"
|
| +
|
| +namespace content {
|
| +
|
| +StreamRegistry::StreamRegistry() {
|
| +}
|
| +
|
| +StreamRegistry::~StreamRegistry() {
|
| +}
|
| +
|
| +void StreamRegistry::RegisterStream(scoped_refptr<Stream> stream) {
|
| + GURL url(std::string(chrome::kBlobScheme) + ":" +
|
| + stream->security_origin().spec() +
|
| + base::GenerateGUID());
|
| + stream->SetStreamUrl(url);
|
| + streams_[url] = stream;
|
| +}
|
| +
|
| +scoped_refptr<Stream> StreamRegistry::GetStream(const GURL& url) {
|
| + std::map<GURL, scoped_refptr<Stream> >::iterator stream = streams_.find(url);
|
| + if (stream != streams_.end()) {
|
| + return stream->second;
|
| + } else {
|
| + return NULL;
|
| + }
|
| +}
|
| +
|
| +void StreamRegistry::OnStreamConsumed(Stream* stream) {
|
| + streams_.erase(stream->stream_url());
|
| +}
|
| +
|
| +} // namespace content
|
|
|