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; |
} |