Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Unified Diff: Source/modules/mediasource/SourceBufferList.cpp

Issue 16625011: Add minimal implementation of unprefixed MediaSource API that has feature parity with prefixed API (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix global-constructors-listing-expected.txt Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/mediasource/SourceBufferList.h ('k') | Source/modules/mediasource/SourceBufferList.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/mediasource/SourceBufferList.cpp
diff --git a/Source/modules/mediasource/WebKitSourceBufferList.cpp b/Source/modules/mediasource/SourceBufferList.cpp
similarity index 60%
copy from Source/modules/mediasource/WebKitSourceBufferList.cpp
copy to Source/modules/mediasource/SourceBufferList.cpp
index a949c8e63841d4ad42334a128c72060991a41c4a..ee0aa7d79cef3308e52d427dae44bc67381bd7ce 100644
--- a/Source/modules/mediasource/WebKitSourceBufferList.cpp
+++ b/Source/modules/mediasource/SourceBufferList.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2013 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
@@ -29,60 +29,48 @@
*/
#include "config.h"
-#include "modules/mediasource/WebKitSourceBufferList.h"
+#include "modules/mediasource/SourceBufferList.h"
#include "core/dom/Event.h"
#include "core/dom/GenericEventQueue.h"
-#include "modules/mediasource/WebKitSourceBuffer.h"
+#include "modules/mediasource/SourceBuffer.h"
namespace WebCore {
-WebKitSourceBufferList::WebKitSourceBufferList(ScriptExecutionContext* context, GenericEventQueue* asyncEventQueue)
+SourceBufferList::SourceBufferList(ScriptExecutionContext* context, GenericEventQueue* asyncEventQueue)
: m_scriptExecutionContext(context)
, m_asyncEventQueue(asyncEventQueue)
{
ScriptWrappable::init(this);
}
-unsigned long WebKitSourceBufferList::length() const
+SourceBufferList::~SourceBufferList()
{
- return m_list.size();
+ ASSERT(m_list.isEmpty());
}
-WebKitSourceBuffer* WebKitSourceBufferList::item(unsigned index) const
-{
- if (index >= m_list.size())
- return 0;
- return m_list[index].get();
-}
-
-void WebKitSourceBufferList::add(PassRefPtr<WebKitSourceBuffer> buffer)
+void SourceBufferList::add(PassRefPtr<SourceBuffer> buffer)
{
m_list.append(buffer);
- createAndFireEvent(eventNames().webkitaddsourcebufferEvent);
+ scheduleEvent(eventNames().addsourcebufferEvent);
}
-bool WebKitSourceBufferList::remove(WebKitSourceBuffer* buffer)
+void SourceBufferList::remove(SourceBuffer* buffer)
{
size_t index = m_list.find(buffer);
if (index == notFound)
- return false;
-
- buffer->removedFromMediaSource();
+ return;
m_list.remove(index);
- createAndFireEvent(eventNames().webkitremovesourcebufferEvent);
- return true;
+ scheduleEvent(eventNames().removesourcebufferEvent);
}
-void WebKitSourceBufferList::clear()
+void SourceBufferList::clear()
{
- for (size_t i = 0; i < m_list.size(); ++i)
- m_list[i]->removedFromMediaSource();
m_list.clear();
- createAndFireEvent(eventNames().webkitremovesourcebufferEvent);
+ scheduleEvent(eventNames().removesourcebufferEvent);
}
-void WebKitSourceBufferList::createAndFireEvent(const AtomicString& eventName)
+void SourceBufferList::scheduleEvent(const AtomicString& eventName)
{
ASSERT(m_asyncEventQueue);
@@ -92,22 +80,22 @@ void WebKitSourceBufferList::createAndFireEvent(const AtomicString& eventName)
m_asyncEventQueue->enqueueEvent(event.release());
}
-const AtomicString& WebKitSourceBufferList::interfaceName() const
+const AtomicString& SourceBufferList::interfaceName() const
{
- return eventNames().interfaceForWebKitSourceBufferList;
+ return eventNames().interfaceForSourceBufferList;
}
-ScriptExecutionContext* WebKitSourceBufferList::scriptExecutionContext() const
+ScriptExecutionContext* SourceBufferList::scriptExecutionContext() const
{
return m_scriptExecutionContext;
}
-EventTargetData* WebKitSourceBufferList::eventTargetData()
+EventTargetData* SourceBufferList::eventTargetData()
{
return &m_eventTargetData;
}
-EventTargetData* WebKitSourceBufferList::ensureEventTargetData()
+EventTargetData* SourceBufferList::ensureEventTargetData()
{
return &m_eventTargetData;
}
« no previous file with comments | « Source/modules/mediasource/SourceBufferList.h ('k') | Source/modules/mediasource/SourceBufferList.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698