Chromium Code Reviews| Index: Source/modules/mediasource/SourceBufferList.cpp |
| diff --git a/Source/modules/mediasource/WebKitSourceBufferList.cpp b/Source/modules/mediasource/SourceBufferList.cpp |
| similarity index 63% |
| copy from Source/modules/mediasource/WebKitSourceBufferList.cpp |
| copy to Source/modules/mediasource/SourceBufferList.cpp |
| index a949c8e63841d4ad42334a128c72060991a41c4a..6c5ef115630fb5a2caa89340ac4ed1020b5df49d 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,65 @@ |
| */ |
| #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() |
| +{ |
| + ASSERT(m_list.isEmpty()); |
| +} |
| + |
| +unsigned long SourceBufferList::length() const |
| { |
| return m_list.size(); |
|
adamk
2013/06/10 23:05:40
Any reason not to inline? Similar questions about
acolwell GONE FROM CHROMIUM
2013/06/10 23:36:15
Done for all non-virtual methods. It isn't clear f
|
| } |
| -WebKitSourceBuffer* WebKitSourceBufferList::item(unsigned index) const |
| +SourceBuffer* SourceBufferList::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); |
| + createAndFireEvent(eventNames().addsourcebufferEvent); |
| } |
| -bool WebKitSourceBufferList::remove(WebKitSourceBuffer* buffer) |
| +bool SourceBufferList::contains(SourceBuffer* buffer) |
| +{ |
| + return m_list.find(buffer) != notFound; |
| +} |
| + |
| +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; |
| + createAndFireEvent(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); |
| + createAndFireEvent(eventNames().removesourcebufferEvent); |
| } |
| -void WebKitSourceBufferList::createAndFireEvent(const AtomicString& eventName) |
| +void SourceBufferList::createAndFireEvent(const AtomicString& eventName) |
| { |
| ASSERT(m_asyncEventQueue); |
| @@ -92,22 +97,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; |
| } |