mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge cedar with mozilla-central
This commit is contained in:
commit
c73cd26712
@ -45,8 +45,6 @@
|
||||
#include "nsCoreUtils.h"
|
||||
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMDocumentView.h"
|
||||
#include "nsIDOMAbstractView.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
|
@ -65,7 +65,7 @@
|
||||
#include "nsIDOMHTMLOptionElement.h"
|
||||
#include "nsIDOMXULElement.h"
|
||||
#include "nsIHTMLDocument.h"
|
||||
#include "nsIImageFrame.h"
|
||||
#include "nsImageFrame.h"
|
||||
#include "nsILink.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIPluginInstance.h"
|
||||
@ -1266,7 +1266,7 @@ nsAccessibilityService::GetAreaAccessible(nsIFrame* aImageFrame,
|
||||
nsAccessible** aImageAccessible)
|
||||
{
|
||||
// Check if frame is an image frame, and content is <area>.
|
||||
nsIImageFrame *imageFrame = do_QueryFrame(aImageFrame);
|
||||
nsImageFrame *imageFrame = do_QueryFrame(aImageFrame);
|
||||
if (!imageFrame)
|
||||
return nsnull;
|
||||
|
||||
|
@ -43,15 +43,12 @@
|
||||
#include "nsAccessNode.h"
|
||||
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMAbstractView.h"
|
||||
#include "nsIDOM3Node.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMDocumentView.h"
|
||||
#include "nsIDOMHTMLDocument.h"
|
||||
#include "nsIDOMHTMLElement.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIDOMRange.h"
|
||||
#include "nsIDOMViewCSS.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsIDOMXULElement.h"
|
||||
#include "nsIDocShell.h"
|
||||
@ -425,13 +422,12 @@ nsCoreUtils::GetScreenCoordsForWindow(nsINode *aNode)
|
||||
nsCOMPtr<nsIDocShellTreeItem> rootTreeItem;
|
||||
treeItem->GetRootTreeItem(getter_AddRefs(rootTreeItem));
|
||||
nsCOMPtr<nsIDOMDocument> domDoc = do_GetInterface(rootTreeItem);
|
||||
nsCOMPtr<nsIDOMDocumentView> docView(do_QueryInterface(domDoc));
|
||||
if (!docView)
|
||||
if (!domDoc)
|
||||
return coords;
|
||||
|
||||
nsCOMPtr<nsIDOMAbstractView> abstractView;
|
||||
docView->GetDefaultView(getter_AddRefs(abstractView));
|
||||
nsCOMPtr<nsIDOMWindowInternal> windowInter(do_QueryInterface(abstractView));
|
||||
nsCOMPtr<nsIDOMWindow> window;
|
||||
domDoc->GetDefaultView(getter_AddRefs(window));
|
||||
nsCOMPtr<nsIDOMWindowInternal> windowInter(do_QueryInterface(window));
|
||||
if (!windowInter)
|
||||
return coords;
|
||||
|
||||
@ -597,14 +593,14 @@ nsCoreUtils::GetComputedStyleDeclaration(const nsAString& aPseudoElt,
|
||||
if (!document)
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMViewCSS> viewCSS(do_QueryInterface(document->GetWindow()));
|
||||
if (!viewCSS)
|
||||
nsCOMPtr<nsIDOMWindow> window = do_QueryInterface(document->GetWindow());
|
||||
if (!window)
|
||||
return nsnull;
|
||||
|
||||
nsIDOMCSSStyleDeclaration* cssDecl = nsnull;
|
||||
nsCOMPtr<nsIDOMCSSStyleDeclaration> cssDecl;
|
||||
nsCOMPtr<nsIDOMElement> domElement(do_QueryInterface(content));
|
||||
viewCSS->GetComputedStyle(domElement, aPseudoElt, &cssDecl);
|
||||
return cssDecl;
|
||||
window->GetComputedStyle(domElement, aPseudoElt, getter_AddRefs(cssDecl));
|
||||
return cssDecl.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<nsIBoxObject>
|
||||
|
@ -47,8 +47,8 @@
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMHTMLAreaElement.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIImageFrame.h"
|
||||
#include "nsIImageMap.h"
|
||||
#include "nsImageFrame.h"
|
||||
#include "nsImageMap.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLImageMapAccessible
|
||||
@ -203,14 +203,12 @@ nsHTMLAreaAccessible::GetBounds(PRInt32 *aX, PRInt32 *aY,
|
||||
|
||||
nsIFrame *frame = GetFrame();
|
||||
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
|
||||
nsIImageFrame *imageFrame = do_QueryFrame(frame);
|
||||
nsImageFrame *imageFrame = do_QueryFrame(frame);
|
||||
|
||||
nsCOMPtr<nsIImageMap> map;
|
||||
imageFrame->GetImageMap(presContext, getter_AddRefs(map));
|
||||
nsImageMap* map = imageFrame->GetImageMap(presContext);
|
||||
NS_ENSURE_TRUE(map, NS_ERROR_FAILURE);
|
||||
|
||||
nsRect rect;
|
||||
nsIntRect orgRectPixels;
|
||||
nsresult rv = map->GetBoundsForAreaContent(mContent, rect);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
@ -223,7 +221,7 @@ nsHTMLAreaAccessible::GetBounds(PRInt32 *aX, PRInt32 *aY,
|
||||
*aHeight = presContext->AppUnitsToDevPixels(rect.height - rect.y);
|
||||
|
||||
// Put coords in absolute screen coords
|
||||
orgRectPixels = frame->GetScreenRectExternal();
|
||||
nsIntRect orgRectPixels = frame->GetScreenRectExternal();
|
||||
*aX += orgRectPixels.x;
|
||||
*aY += orgRectPixels.y;
|
||||
|
||||
|
@ -47,11 +47,9 @@
|
||||
|
||||
#include "nsIClipboard.h"
|
||||
#include "nsContentCID.h"
|
||||
#include "nsIDOMAbstractView.h"
|
||||
#include "nsIDOMCharacterData.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDOMDocumentView.h"
|
||||
#include "nsIDOMRange.h"
|
||||
#include "nsIDOMNSRange.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
|
@ -52,7 +52,6 @@
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIDOMNSHTMLElement.h"
|
||||
#include "nsIDOMViewCSS.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIPrefService.h"
|
||||
|
@ -15,6 +15,12 @@
|
||||
</targetApplication>
|
||||
</versionRange>
|
||||
</emItem>
|
||||
<emItem id="krupa.raj+545@gmail.com">
|
||||
<versionRange severity="2"/>
|
||||
</emItem>
|
||||
<emItem id="krups@krup12s.com">
|
||||
<versionRange severity="3"/>
|
||||
</emItem>
|
||||
<emItem id="langpack-vi-VN@firefox.mozilla.org">
|
||||
<versionRange minVersion="2.0" maxVersion="2.0"/>
|
||||
</emItem>
|
||||
@ -36,6 +42,9 @@
|
||||
<emItem id="msntoolbar@msn.com">
|
||||
<versionRange minVersion=" " maxVersion="6.*"/>
|
||||
</emItem>
|
||||
<emItem id="near799@wdios.com" os="Android">
|
||||
<versionRange minVersion="0.8" maxVersion="1.0" severity="3"/>
|
||||
</emItem>
|
||||
<emItem id="personas@christopher.beard">
|
||||
<versionRange minVersion="1.6" maxVersion="1.6">
|
||||
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
|
||||
@ -46,6 +55,9 @@
|
||||
<emItem id="ShopperReports@ShopperReports.com">
|
||||
<versionRange minVersion="3.1.22.0" maxVersion="3.1.22.0"/>
|
||||
</emItem>
|
||||
<emItem id="sidecar-test-addon20110103118@amazon.com" os="MACOSX, Windows, Linux">
|
||||
<versionRange severity="3"/>
|
||||
</emItem>
|
||||
<emItem id="support@daemon-tools.cc">
|
||||
<versionRange minVersion=" " maxVersion="1.0.0.5"/>
|
||||
</emItem>
|
||||
@ -184,5 +196,38 @@
|
||||
<driverVersion>7.0.0.0</driverVersion>
|
||||
<driverVersionComparator>GREATER_THAN_OR_EQUAL</driverVersionComparator>
|
||||
</gfxBlacklistEntry>
|
||||
<gfxBlacklistEntry>
|
||||
<os>MAC OS X 10.5.8</os>
|
||||
<vendor>0x10de</vendor>
|
||||
<feature>DIRECT3D_9_LAYERS</feature>
|
||||
<driverVersion>7.0.0.0</driverVersion>
|
||||
<driverVersionComparator>GREATER_THAN_OR_EQUAL</driverVersionComparator>
|
||||
</gfxBlacklistEntry>
|
||||
<gfxBlacklistEntry>
|
||||
<os>MAC OS X 10.5.8</os>
|
||||
<vendor>0x10de</vendor>
|
||||
<feature>DIRECT3D_9_LAYERS</feature>
|
||||
<featureStatus>BLOCKED_DRIVER_VERSION</featureStatus>
|
||||
<driverVersion>7.0.0.0</driverVersion>
|
||||
<driverVersionComparator>GREATER_THAN_OR_EQUAL</driverVersionComparator>
|
||||
</gfxBlacklistEntry>
|
||||
<gfxBlacklistEntry>
|
||||
<os>MAC OS X 10.6</os>
|
||||
<vendor>0x10de</vendor>
|
||||
<devices>
|
||||
<device>0x0a6c</device>
|
||||
</devices>
|
||||
<feature>DIRECT3D_9_LAYERS</feature>
|
||||
<featureStatus>BLOCKED_DRIVER_VERSION</featureStatus>
|
||||
<driverVersion>8.17.12.5896</driverVersion>
|
||||
<driverVersionComparator>LESS_THAN_OR_EQUAL</driverVersionComparator>
|
||||
</gfxBlacklistEntry>
|
||||
<gfxBlacklistEntry>
|
||||
<os>MAC OS X 10.6</os>
|
||||
<vendor>0x10de</vendor>
|
||||
<feature>DIRECT3D_9_LAYERS</feature>
|
||||
<driverVersion>7.0.0.0</driverVersion>
|
||||
<driverVersionComparator>GREATER_THAN_OR_EQUAL</driverVersionComparator>
|
||||
</gfxBlacklistEntry>
|
||||
</gfxItems>
|
||||
</blocklist>
|
||||
|
@ -55,6 +55,7 @@ const POPUP_SHOW_ON_RESULTS = "extensions.testpilot.popup.showOnNewResults";
|
||||
const POPUP_CHECK_INTERVAL = "extensions.testpilot.popup.delayAfterStartup";
|
||||
const POPUP_REMINDER_INTERVAL = "extensions.testpilot.popup.timeBetweenChecks";
|
||||
const ALWAYS_SUBMIT_DATA = "extensions.testpilot.alwaysSubmitData";
|
||||
const UPDATE_CHANNEL_PREF = "app.update.channel";
|
||||
const LOG_FILE_NAME = "TestPilotErrorLog.log";
|
||||
const RANDOM_DEPLOY_PREFIX = "extensions.testpilot.deploymentRandomizer";
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
# Contributor(s):
|
||||
# Ehsan Akhgari <ehsan.akhgari@gmail.com>
|
||||
# Rob Campbell <rcampbell@mozilla.com>
|
||||
# Steffen Wilberg <steffen.wilberg@web.de>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
@ -379,16 +380,15 @@
|
||||
oncommand="BrowserGoHome(event);"
|
||||
onclick="checkForMiddleClick(this, event);"
|
||||
key="goHome"/>
|
||||
<menuseparator id="historyMenuHomeSeparator"
|
||||
class="show-only-for-keyboard"/>
|
||||
<menuitem id="menu_showAllHistory"
|
||||
label="&showAllHistoryCmd2.label;"
|
||||
#ifndef XP_MACOSX
|
||||
key="showAllHistoryKb"
|
||||
#endif
|
||||
command="Browser:ShowAllHistory"/>
|
||||
<menuseparator id="startHistorySeparator"/>
|
||||
<menuseparator id="endHistorySeparator"
|
||||
class="hide-if-empty-places-result"
|
||||
builder="end"/>
|
||||
<menuseparator id="showAllHistorySeparator"/>
|
||||
#ifdef MOZ_SERVICES_SYNC
|
||||
<menuitem id="sync-tabs-menuitem"
|
||||
label="&syncTabsMenu.label;"
|
||||
@ -420,6 +420,8 @@
|
||||
#endif
|
||||
onpopupshowing="document.getElementById('history-menu')._placesView.populateUndoWindowSubmenu();"/>
|
||||
</menu>
|
||||
<menuseparator id="startHistorySeparator"
|
||||
class="hide-if-empty-places-result"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
|
||||
@ -441,6 +443,11 @@
|
||||
if (!this.parentNode._placesView)
|
||||
new PlacesMenu(event, 'place:folder=BOOKMARKS_MENU');"
|
||||
tooltip="bhTooltip" popupsinherittooltip="true">
|
||||
<menuitem id="bookmarksShowAll"
|
||||
label="&showAllBookmarks2.label;"
|
||||
command="Browser:ShowAllBookmarks"
|
||||
key="manBookmarkKb"/>
|
||||
<menuseparator id="organizeBookmarksSeparator"/>
|
||||
<menuitem id="menu_bookmarkThisPage"
|
||||
label="&bookmarkThisPageCmd.label;"
|
||||
command="Browser:AddBookmarkAs"
|
||||
@ -469,16 +476,12 @@
|
||||
class="show-only-for-keyboard"
|
||||
command="Browser:BookmarkAllTabs"
|
||||
key="bookmarkAllTabsKb"/>
|
||||
<menuitem id="bookmarksShowAll"
|
||||
label="&showAllBookmarks2.label;"
|
||||
command="Browser:ShowAllBookmarks"
|
||||
key="manBookmarkKb"/>
|
||||
<menuseparator id="organizeBookmarksSeparator"/>
|
||||
<menuseparator id="bookmarksToolbarSeparator"/>
|
||||
<menu id="bookmarksToolbarFolderMenu"
|
||||
class="menu-iconic bookmark-item"
|
||||
label="&personalbarCmd.label;"
|
||||
container="true">
|
||||
<menupopup id="bookmarksToolbarFolderPopup"
|
||||
<menupopup id="bookmarksToolbarFolderPopup"
|
||||
#ifndef XP_MACOSX
|
||||
placespopup="true"
|
||||
#endif
|
||||
@ -486,7 +489,13 @@
|
||||
onpopupshowing="if (!this.parentNode._placesView)
|
||||
new PlacesMenu(event, 'place:folder=TOOLBAR');"/>
|
||||
</menu>
|
||||
<menuseparator/>
|
||||
<menuseparator id="bookmarksMenuItemsSeparator"/>
|
||||
<!-- Bookmarks menu items -->
|
||||
<menuseparator builder="end"
|
||||
class="hide-if-empty-places-result"/>
|
||||
<menuitem id="menu_unsortedBookmarks"
|
||||
label="&unsortedBookmarksCmd.label;"
|
||||
oncommand="PlacesCommandHook.showPlacesOrganizer('UnfiledBookmarks');"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
|
||||
|
@ -489,7 +489,7 @@ function HistoryMenu(aPopupShowingEvent) {
|
||||
"@mozilla.org/browser/sessionstore;1",
|
||||
"nsISessionStore");
|
||||
PlacesMenu.call(this, aPopupShowingEvent,
|
||||
"place:redirectsMode=2&sort=4&maxResults=10");
|
||||
"place:redirectsMode=2&sort=4&maxResults=15");
|
||||
}
|
||||
|
||||
HistoryMenu.prototype = {
|
||||
|
@ -320,8 +320,8 @@ var PlacesUIUtils = {
|
||||
function PUIU__reportDeprecatedAddBookmarkMethod() {
|
||||
// Removes "PUIU_".
|
||||
let oldFuncName = arguments.callee.caller.name.slice(5);
|
||||
Cu.reportError(oldFuncName + " is deprecated and will be removed in a \
|
||||
future release. Use showBookmarkDialog instead");
|
||||
Cu.reportError(oldFuncName + " is deprecated and will be removed in a " +
|
||||
"future release. Use showBookmarkDialog instead.");
|
||||
},
|
||||
|
||||
/**
|
||||
@ -810,16 +810,16 @@ var PlacesUIUtils = {
|
||||
|
||||
// If a view wasn't expected, the method should have got a window.
|
||||
if (aView === null) {
|
||||
Components.utils.reportError("The api has changed. A window should be \
|
||||
passed to " + caller.name + ". Not \
|
||||
passing a window will throw in a future \
|
||||
release.");
|
||||
Components.utils.reportError("The api has changed. A window should be " +
|
||||
"passed to " + caller.name + ". Not " +
|
||||
"passing a window will throw in a future " +
|
||||
"release.");
|
||||
}
|
||||
else {
|
||||
Components.utils.reportError("The api has changed. A places view \
|
||||
should be passed to " + caller.name + ". \
|
||||
Not passing a view will throw in a future \
|
||||
release.");
|
||||
Components.utils.reportError("The api has changed. A places view " +
|
||||
"should be passed to " + caller.name + ". " +
|
||||
"Not passing a view will throw in a future " +
|
||||
"release.");
|
||||
}
|
||||
|
||||
// This could certainly break in some edge cases (like bug 562998), but
|
||||
|
@ -104,7 +104,7 @@ can reach it easily. -->
|
||||
<!ENTITY subscribeToPageMenuitem.label "Subscribe to This Page…">
|
||||
<!ENTITY addCurPagesCmd.label "Bookmark All Tabs…">
|
||||
<!ENTITY showAllBookmarks2.label "Show All Bookmarks">
|
||||
<!ENTITY bookmarkAllCmd.label "Bookmark All Tabs…">
|
||||
<!ENTITY unsortedBookmarksCmd.label "Unsorted Bookmarks">
|
||||
<!ENTITY bookmarksToolbarChevron.tooltip "Show more bookmarks">
|
||||
|
||||
<!ENTITY backCmd.label "Back">
|
||||
|
@ -1120,6 +1120,38 @@ public:
|
||||
NS_NOTREACHED("How did we get here?");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the previous nsIContent in the pre-order tree traversal of the DOM. If
|
||||
* aRoot is non-null, then it must be an ancestor of |this|
|
||||
* (possibly equal to |this|) and only nsIContents that are descendants of
|
||||
* aRoot, including aRoot itself, will be returned. Returns
|
||||
* null if there are no more nsIContents to traverse.
|
||||
*/
|
||||
nsIContent* GetPreviousContent(const nsINode* aRoot = nsnull) const
|
||||
{
|
||||
// Can't use nsContentUtils::ContentIsDescendantOf here, since we
|
||||
// can't include it here.
|
||||
#ifdef DEBUG
|
||||
if (aRoot) {
|
||||
const nsINode* cur = this;
|
||||
for (; cur; cur = cur->GetNodeParent())
|
||||
if (cur == aRoot) break;
|
||||
NS_ASSERTION(cur, "aRoot not an ancestor of |this|?");
|
||||
}
|
||||
#endif
|
||||
|
||||
if (this == aRoot) {
|
||||
return nsnull;
|
||||
}
|
||||
nsIContent* cur = this->GetParent();
|
||||
nsIContent* iter = this->GetPreviousSibling();
|
||||
while (iter) {
|
||||
cur = iter;
|
||||
iter = reinterpret_cast<nsINode*>(iter)->GetLastChild();
|
||||
}
|
||||
return cur;
|
||||
}
|
||||
|
||||
/**
|
||||
* Boolean flags
|
||||
*/
|
||||
|
@ -54,7 +54,6 @@
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsIDOMDragEvent.h"
|
||||
#include "nsIDOMAbstractView.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMDocumentRange.h"
|
||||
|
@ -168,7 +168,6 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
|
||||
#include "nsIChromeRegistry.h"
|
||||
#include "nsIMIMEHeaderParam.h"
|
||||
#include "nsIDOMXULCommandEvent.h"
|
||||
#include "nsIDOMAbstractView.h"
|
||||
#include "nsIDOMDragEvent.h"
|
||||
#include "nsDOMDataTransfer.h"
|
||||
#include "nsHtml5Module.h"
|
||||
@ -5523,9 +5522,8 @@ nsContentUtils::DispatchXULCommand(nsIContent* aTarget,
|
||||
nsCOMPtr<nsIDOMXULCommandEvent> xulCommand = do_QueryInterface(event);
|
||||
nsCOMPtr<nsIPrivateDOMEvent> pEvent = do_QueryInterface(xulCommand);
|
||||
NS_ENSURE_STATE(pEvent);
|
||||
nsCOMPtr<nsIDOMAbstractView> view = do_QueryInterface(doc->GetWindow());
|
||||
nsresult rv = xulCommand->InitCommandEvent(NS_LITERAL_STRING("command"),
|
||||
PR_TRUE, PR_TRUE, view,
|
||||
PR_TRUE, PR_TRUE, doc->GetWindow(),
|
||||
0, aCtrl, aAlt, aShift, aMeta,
|
||||
aSourceEvent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -75,8 +75,6 @@
|
||||
#include "nsDOMAttribute.h"
|
||||
#include "nsIDOMDOMStringList.h"
|
||||
#include "nsIDOMDOMImplementation.h"
|
||||
#include "nsIDOMDocumentView.h"
|
||||
#include "nsIDOMAbstractView.h"
|
||||
#include "nsIDOMDocumentXBL.h"
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
#include "nsGenericElement.h"
|
||||
@ -1596,9 +1594,11 @@ nsDocument::~nsDocument()
|
||||
mStyleSheetSetList->Disconnect();
|
||||
}
|
||||
|
||||
#ifdef MOZ_SMIL
|
||||
if (mAnimationController) {
|
||||
mAnimationController->Disconnect();
|
||||
}
|
||||
#endif // MOZ_SMIL
|
||||
|
||||
mParentDocument = nsnull;
|
||||
|
||||
@ -5075,16 +5075,14 @@ nsDocument::CreateTreeWalker(nsIDOMNode *aRoot,
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::GetDefaultView(nsIDOMAbstractView** aDefaultView)
|
||||
nsDocument::GetDefaultView(nsIDOMWindow** aDefaultView)
|
||||
{
|
||||
nsPIDOMWindow* win = GetWindow();
|
||||
if (win) {
|
||||
return CallQueryInterface(win, aDefaultView);
|
||||
}
|
||||
|
||||
*aDefaultView = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
nsPIDOMWindow* win = GetWindow();
|
||||
if (!win) {
|
||||
return NS_OK;
|
||||
}
|
||||
return CallQueryInterface(win, aDefaultView);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -8329,7 +8327,7 @@ nsDocument::SetImagesNeedAnimating(PRBool aAnimating)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::CreateTouch(nsIDOMAbstractView* aView,
|
||||
nsDocument::CreateTouch(nsIDOMWindow* aView,
|
||||
nsIDOMEventTarget* aTarget,
|
||||
PRInt32 aIdentifier,
|
||||
PRInt32 aPageX,
|
||||
|
@ -52,7 +52,6 @@
|
||||
#include "nsTArray.h"
|
||||
#include "nsHashSets.h"
|
||||
#include "nsIDOMXMLDocument.h"
|
||||
#include "nsIDOMDocumentView.h"
|
||||
#include "nsIDOMDocumentXBL.h"
|
||||
#include "nsIDOMNSDocument.h"
|
||||
#include "nsIDOMNSDocumentStyle.h"
|
||||
@ -499,7 +498,6 @@ class nsDocument : public nsIDocument,
|
||||
public nsIDOMDocumentEvent,
|
||||
public nsIDOM3DocumentEvent,
|
||||
public nsIDOMNSDocumentStyle,
|
||||
public nsIDOMDocumentView,
|
||||
public nsIDOMDocumentRange,
|
||||
public nsIDOMDocumentTraversal,
|
||||
public nsIDOMDocumentXBL,
|
||||
@ -816,9 +814,6 @@ public:
|
||||
// nsIDOMNSDocumentStyle
|
||||
NS_DECL_NSIDOMNSDOCUMENTSTYLE
|
||||
|
||||
// nsIDOMDocumentView
|
||||
NS_DECL_NSIDOMDOCUMENTVIEW
|
||||
|
||||
// nsIDOMDocumentRange
|
||||
NS_DECL_NSIDOMDOCUMENTRANGE
|
||||
|
||||
@ -1268,7 +1263,6 @@ protected:
|
||||
NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsIDOMDocument, nsDocument) \
|
||||
NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsIDOMNSDocument, nsDocument) \
|
||||
NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsIDOMDocumentEvent, nsDocument) \
|
||||
NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsIDOMDocumentView, nsDocument) \
|
||||
NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsIDOMDocumentTraversal, \
|
||||
nsDocument) \
|
||||
NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsIDOMEventTarget, nsDocument) \
|
||||
|
@ -92,7 +92,6 @@
|
||||
|
||||
#include "nsBindingManager.h"
|
||||
#include "nsXBLBinding.h"
|
||||
#include "nsIDOMViewCSS.h"
|
||||
#include "nsIXBLService.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIBoxObject.h"
|
||||
@ -2283,18 +2282,15 @@ nsGenericElement::InternalIsSupported(nsISupports* aObject,
|
||||
PL_strcmp(v, "3.0") == 0) {
|
||||
*aReturn = PR_TRUE;
|
||||
}
|
||||
}
|
||||
#ifdef MOZ_SVG
|
||||
else if (PL_strcasecmp(f, "SVGEvents") == 0 ||
|
||||
PL_strcasecmp(f, "SVGZoomEvents") == 0 ||
|
||||
nsSVGFeatures::HaveFeature(aFeature)) {
|
||||
} else if (PL_strcasecmp(f, "SVGEvents") == 0 ||
|
||||
PL_strcasecmp(f, "SVGZoomEvents") == 0 ||
|
||||
nsSVGFeatures::HaveFeature(aObject, aFeature)) {
|
||||
if (aVersion.IsEmpty() ||
|
||||
PL_strcmp(v, "1.0") == 0 ||
|
||||
PL_strcmp(v, "1.1") == 0) {
|
||||
*aReturn = PR_TRUE;
|
||||
}
|
||||
}
|
||||
#endif /* MOZ_SVG */
|
||||
#ifdef MOZ_SMIL
|
||||
else if (NS_SMILEnabled() && PL_strcasecmp(f, "TimeControl") == 0) {
|
||||
if (aVersion.IsEmpty() || PL_strcmp(v, "1.0") == 0) {
|
||||
|
@ -1698,7 +1698,7 @@ GK_ATOM(onMozTouchMove, "onMozTouchMove")
|
||||
GK_ATOM(onMozTouchUp, "onMozTouchUp")
|
||||
|
||||
// orientation support
|
||||
GK_ATOM(onMozOrientation, "onMozOrientation")
|
||||
GK_ATOM(ondeviceorientation, "ondeviceorientation")
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Special atoms
|
||||
|
@ -90,7 +90,7 @@ NS_NewDOMMutationEvent(nsIDOMEvent** aResult NS_OUTPARAM, nsPresContext* aPresCo
|
||||
nsresult
|
||||
NS_NewDOMPopupBlockedEvent(nsIDOMEvent** aResult, nsPresContext* aPresContext, nsEvent* aEvent);
|
||||
nsresult
|
||||
NS_NewDOMOrientationEvent(nsIDOMEvent** aResult, nsPresContext* aPresContext, nsEvent* aEvent);
|
||||
NS_NewDOMDeviceOrientationEvent(nsIDOMEvent** aResult, nsPresContext* aPresContext, nsEvent* aEvent);
|
||||
nsresult
|
||||
NS_NewDOMTextEvent(nsIDOMEvent** aResult, nsPresContext* aPresContext, class nsTextEvent* aEvent);
|
||||
nsresult
|
||||
|
@ -80,7 +80,7 @@ NS_INTERFACE_MAP_END_INHERITING(nsDOMMouseEvent)
|
||||
NS_IMETHODIMP
|
||||
nsDOMDragEvent::InitDragEvent(const nsAString & aType,
|
||||
PRBool aCanBubble, PRBool aCancelable,
|
||||
nsIDOMAbstractView* aView, PRInt32 aDetail,
|
||||
nsIDOMWindow* aView, PRInt32 aDetail,
|
||||
PRInt32 aScreenX, PRInt32 aScreenY,
|
||||
PRInt32 aClientX, PRInt32 aClientY,
|
||||
PRBool aCtrlKey, PRBool aAltKey, PRBool aShiftKey,
|
||||
@ -132,7 +132,5 @@ nsresult NS_NewDOMDragEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
nsDragEvent *aEvent)
|
||||
{
|
||||
nsDOMDragEvent* event = new nsDOMDragEvent(aPresContext, aEvent);
|
||||
NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
return CallQueryInterface(event, aInstancePtrResult);
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ nsDOMKeyboardEvent::GetWhich(PRUint32* aWhich)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMKeyboardEvent::InitKeyEvent(const nsAString& aType, PRBool aCanBubble, PRBool aCancelable,
|
||||
nsIDOMAbstractView* aView, PRBool aCtrlKey, PRBool aAltKey,
|
||||
nsIDOMWindow* aView, PRBool aCtrlKey, PRBool aAltKey,
|
||||
PRBool aShiftKey, PRBool aMetaKey,
|
||||
PRUint32 aKeyCode, PRUint32 aCharCode)
|
||||
{
|
||||
@ -198,9 +198,5 @@ nsresult NS_NewDOMKeyboardEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
nsKeyEvent *aEvent)
|
||||
{
|
||||
nsDOMKeyboardEvent* it = new nsDOMKeyboardEvent(aPresContext, aEvent);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return CallQueryInterface(it, aInstancePtrResult);
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMMouseEvent::InitMouseEvent(const nsAString & aType, PRBool aCanBubble, PRBool aCancelable,
|
||||
nsIDOMAbstractView *aView, PRInt32 aDetail, PRInt32 aScreenX,
|
||||
nsIDOMWindow* aView, PRInt32 aDetail, PRInt32 aScreenX,
|
||||
PRInt32 aScreenY, PRInt32 aClientX, PRInt32 aClientY,
|
||||
PRBool aCtrlKey, PRBool aAltKey, PRBool aShiftKey,
|
||||
PRBool aMetaKey, PRUint16 aButton, nsIDOMEventTarget *aRelatedTarget)
|
||||
@ -147,7 +147,7 @@ nsDOMMouseEvent::InitMouseEvent(const nsAString & aType, PRBool aCanBubble, PRBo
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMMouseEvent::InitNSMouseEvent(const nsAString & aType, PRBool aCanBubble, PRBool aCancelable,
|
||||
nsIDOMAbstractView *aView, PRInt32 aDetail, PRInt32 aScreenX,
|
||||
nsIDOMWindow *aView, PRInt32 aDetail, PRInt32 aScreenX,
|
||||
PRInt32 aScreenY, PRInt32 aClientX, PRInt32 aClientY,
|
||||
PRBool aCtrlKey, PRBool aAltKey, PRBool aShiftKey,
|
||||
PRBool aMetaKey, PRUint16 aButton, nsIDOMEventTarget *aRelatedTarget,
|
||||
@ -313,9 +313,5 @@ nsresult NS_NewDOMMouseEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
nsInputEvent *aEvent)
|
||||
{
|
||||
nsDOMMouseEvent* it = new nsDOMMouseEvent(aPresContext, aEvent);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return CallQueryInterface(it, aInstancePtrResult);
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ NS_INTERFACE_MAP_END_INHERITING(nsDOMMouseEvent)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMMouseScrollEvent::InitMouseScrollEvent(const nsAString & aType, PRBool aCanBubble, PRBool aCancelable,
|
||||
nsIDOMAbstractView *aView, PRInt32 aDetail, PRInt32 aScreenX,
|
||||
nsIDOMWindow *aView, PRInt32 aDetail, PRInt32 aScreenX,
|
||||
PRInt32 aScreenY, PRInt32 aClientX, PRInt32 aClientY,
|
||||
PRBool aCtrlKey, PRBool aAltKey, PRBool aShiftKey,
|
||||
PRBool aMetaKey, PRUint16 aButton, nsIDOMEventTarget *aRelatedTarget,
|
||||
@ -129,9 +129,5 @@ nsresult NS_NewDOMMouseScrollEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
nsInputEvent *aEvent)
|
||||
{
|
||||
nsDOMMouseScrollEvent* it = new nsDOMMouseScrollEvent(aPresContext, aEvent);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return CallQueryInterface(it, aInstancePtrResult);
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ NS_IMETHODIMP
|
||||
nsDOMMozTouchEvent::InitMozTouchEvent(const nsAString& aTypeArg,
|
||||
PRBool aCanBubbleArg,
|
||||
PRBool aCancelableArg,
|
||||
nsIDOMAbstractView* aViewArg,
|
||||
nsIDOMWindow* aViewArg,
|
||||
PRInt32 aDetailArg,
|
||||
PRInt32 aScreenX,
|
||||
PRInt32 aScreenY,
|
||||
@ -127,8 +127,5 @@ nsresult NS_NewDOMMozTouchEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
nsMozTouchEvent *aEvent)
|
||||
{
|
||||
nsDOMMozTouchEvent *it = new nsDOMMozTouchEvent(aPresContext, aEvent);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return CallQueryInterface(it, aInstancePtrResult);
|
||||
}
|
||||
|
@ -40,59 +40,75 @@
|
||||
NS_IMPL_ADDREF_INHERITED(nsDOMOrientationEvent, nsDOMEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDOMOrientationEvent, nsDOMEvent)
|
||||
|
||||
DOMCI_DATA(OrientationEvent, nsDOMOrientationEvent)
|
||||
DOMCI_DATA(DeviceOrientationEvent, nsDOMOrientationEvent)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsDOMOrientationEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMOrientationEvent)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(OrientationEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMDeviceOrientationEvent)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(DeviceOrientationEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
|
||||
|
||||
NS_IMETHODIMP nsDOMOrientationEvent::InitOrientationEvent(const nsAString & eventTypeArg,
|
||||
PRBool canBubbleArg,
|
||||
PRBool cancelableArg,
|
||||
double x,
|
||||
double y,
|
||||
double z)
|
||||
NS_IMETHODIMP nsDOMOrientationEvent::InitDeviceOrientationEvent(const nsAString & aEventTypeArg,
|
||||
PRBool aCanBubbleArg,
|
||||
PRBool aCancelableArg,
|
||||
double aAlpha,
|
||||
double aBeta,
|
||||
double aGamma,
|
||||
PRBool aAbsolute)
|
||||
{
|
||||
nsresult rv = nsDOMEvent::InitEvent(eventTypeArg, canBubbleArg, cancelableArg);
|
||||
nsresult rv = nsDOMEvent::InitEvent(aEventTypeArg, aCanBubbleArg, aCancelableArg);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mX = x;
|
||||
mY = y;
|
||||
mZ = z;
|
||||
mAlpha = aAlpha;
|
||||
mBeta = aBeta;
|
||||
mGamma = aGamma;
|
||||
mAbsolute = aAbsolute;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsDOMOrientationEvent::GetX(double *aX)
|
||||
NS_IMETHODIMP nsDOMOrientationEvent::GetAlpha(double *aAlpha)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aX);
|
||||
NS_ENSURE_ARG_POINTER(aAlpha);
|
||||
|
||||
*aX = mX;
|
||||
*aAlpha = mAlpha;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDOMOrientationEvent::GetY(double *aY)
|
||||
NS_IMETHODIMP nsDOMOrientationEvent::GetBeta(double *aBeta)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aY);
|
||||
NS_ENSURE_ARG_POINTER(aBeta);
|
||||
|
||||
*aY = mY;
|
||||
*aBeta = mBeta;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDOMOrientationEvent::GetZ(double *aZ)
|
||||
NS_IMETHODIMP nsDOMOrientationEvent::GetGamma(double *aGamma)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aZ);
|
||||
NS_ENSURE_ARG_POINTER(aGamma);
|
||||
|
||||
*aZ = mZ;
|
||||
*aGamma = mGamma;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDOMOrientationEvent::GetAbsolute(PRBool *aAbsolute)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aAbsolute);
|
||||
|
||||
nsresult NS_NewDOMOrientationEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
nsPresContext* aPresContext,
|
||||
nsEvent *aEvent)
|
||||
*aAbsolute = mAbsolute;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDOMOrientationEvent::GetCompassCalibrated(PRBool *aCompassCalibrated)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCompassCalibrated);
|
||||
|
||||
*aCompassCalibrated = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult NS_NewDOMDeviceOrientationEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
nsPresContext* aPresContext,
|
||||
nsEvent *aEvent)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
|
||||
|
||||
|
@ -37,19 +37,20 @@
|
||||
#ifndef nsDOMOrientationEvent_h__
|
||||
#define nsDOMOrientationEvent_h__
|
||||
|
||||
#include "nsIDOMOrientationEvent.h"
|
||||
#include "nsIDOMDeviceOrientationEvent.h"
|
||||
#include "nsDOMEvent.h"
|
||||
|
||||
class nsDOMOrientationEvent : public nsDOMEvent,
|
||||
public nsIDOMOrientationEvent
|
||||
public nsIDOMDeviceOrientationEvent
|
||||
{
|
||||
public:
|
||||
|
||||
nsDOMOrientationEvent(nsPresContext* aPresContext, nsEvent* aEvent)
|
||||
: nsDOMEvent(aPresContext, aEvent),
|
||||
mX(0),
|
||||
mY(0),
|
||||
mZ(0) {}
|
||||
mAlpha(0),
|
||||
mBeta(0),
|
||||
mGamma(0),
|
||||
mAbsolute(PR_TRUE) {}
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
@ -57,10 +58,11 @@ public:
|
||||
NS_FORWARD_TO_NSDOMEVENT
|
||||
|
||||
// nsIDOMOrientationEvent Interface
|
||||
NS_DECL_NSIDOMORIENTATIONEVENT
|
||||
NS_DECL_NSIDOMDEVICEORIENTATIONEVENT
|
||||
|
||||
protected:
|
||||
double mX, mY, mZ;
|
||||
double mAlpha, mBeta, mGamma;
|
||||
PRBool mAbsolute;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -101,7 +101,7 @@ NS_IMETHODIMP
|
||||
nsDOMScrollAreaEvent::InitScrollAreaEvent(const nsAString &aEventType,
|
||||
PRBool aCanBubble,
|
||||
PRBool aCancelable,
|
||||
nsIDOMAbstractView *aView,
|
||||
nsIDOMWindow *aView,
|
||||
PRInt32 aDetail,
|
||||
float aX, float aY,
|
||||
float aWidth, float aHeight)
|
||||
@ -156,10 +156,5 @@ NS_NewDOMScrollAreaEvent(nsIDOMEvent **aInstancePtrResult,
|
||||
nsScrollAreaEvent *aEvent)
|
||||
{
|
||||
nsDOMScrollAreaEvent *ev = new nsDOMScrollAreaEvent(aPresContext, aEvent);
|
||||
|
||||
if (!ev) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return CallQueryInterface(ev, aInstancePtrResult);
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ NS_IMETHODIMP
|
||||
nsDOMSimpleGestureEvent::InitSimpleGestureEvent(const nsAString& aTypeArg,
|
||||
PRBool aCanBubbleArg,
|
||||
PRBool aCancelableArg,
|
||||
nsIDOMAbstractView* aViewArg,
|
||||
nsIDOMWindow* aViewArg,
|
||||
PRInt32 aDetailArg,
|
||||
PRInt32 aScreenX,
|
||||
PRInt32 aScreenY,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */
|
||||
/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
@ -244,7 +244,7 @@ NS_IMETHODIMP
|
||||
nsDOMTouchEvent::InitTouchEvent(const nsAString& aType,
|
||||
PRBool aCanBubble,
|
||||
PRBool aCancelable,
|
||||
nsIDOMAbstractView* aView,
|
||||
nsIDOMWindow* aView,
|
||||
PRInt32 aDetail,
|
||||
PRBool aCtrlKey,
|
||||
PRBool aAltKey,
|
||||
|
@ -176,7 +176,7 @@ nsDOMUIEvent::GetClientPoint()
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMUIEvent::GetView(nsIDOMAbstractView** aView)
|
||||
nsDOMUIEvent::GetView(nsIDOMWindow** aView)
|
||||
{
|
||||
*aView = mView;
|
||||
NS_IF_ADDREF(*aView);
|
||||
@ -191,7 +191,11 @@ nsDOMUIEvent::GetDetail(PRInt32* aDetail)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMUIEvent::InitUIEvent(const nsAString & typeArg, PRBool canBubbleArg, PRBool cancelableArg, nsIDOMAbstractView *viewArg, PRInt32 detailArg)
|
||||
nsDOMUIEvent::InitUIEvent(const nsAString& typeArg,
|
||||
PRBool canBubbleArg,
|
||||
PRBool cancelableArg,
|
||||
nsIDOMWindow* viewArg,
|
||||
PRInt32 detailArg)
|
||||
{
|
||||
nsresult rv = nsDOMEvent::InitEvent(typeArg, canBubbleArg, cancelableArg);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -418,9 +422,5 @@ nsresult NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
nsGUIEvent *aEvent)
|
||||
{
|
||||
nsDOMUIEvent* it = new nsDOMUIEvent(aPresContext, aEvent);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return CallQueryInterface(it, aInstancePtrResult);
|
||||
}
|
||||
|
@ -36,12 +36,11 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsDOMUIEvent_h__
|
||||
#define nsDOMUIEvent_h__
|
||||
#ifndef nsDOMUIEvent_h
|
||||
#define nsDOMUIEvent_h
|
||||
|
||||
#include "nsIDOMUIEvent.h"
|
||||
#include "nsIDOMNSUIEvent.h"
|
||||
#include "nsIDOMAbstractView.h"
|
||||
#include "nsDOMEvent.h"
|
||||
|
||||
class nsDOMUIEvent : public nsDOMEvent,
|
||||
@ -78,7 +77,7 @@ protected:
|
||||
nsIntPoint GetPagePoint();
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIDOMAbstractView> mView;
|
||||
nsCOMPtr<nsIDOMWindow> mView;
|
||||
PRInt32 mDetail;
|
||||
nsIntPoint mClientPoint;
|
||||
// Screenpoint is mEvent->refPoint.
|
||||
@ -90,4 +89,4 @@ protected:
|
||||
NS_FORWARD_NSIDOMUIEVENT(nsDOMUIEvent::) \
|
||||
NS_FORWARD_TO_NSDOMEVENT
|
||||
|
||||
#endif // nsDOMUIEvent_h__
|
||||
#endif // nsDOMUIEvent_h
|
||||
|
@ -118,7 +118,7 @@ nsDOMXULCommandEvent::GetSourceEvent(nsIDOMEvent** aSourceEvent)
|
||||
NS_IMETHODIMP
|
||||
nsDOMXULCommandEvent::InitCommandEvent(const nsAString& aType,
|
||||
PRBool aCanBubble, PRBool aCancelable,
|
||||
nsIDOMAbstractView *aView,
|
||||
nsIDOMWindow* aView,
|
||||
PRInt32 aDetail,
|
||||
PRBool aCtrlKey, PRBool aAltKey,
|
||||
PRBool aShiftKey, PRBool aMetaKey,
|
||||
@ -144,9 +144,5 @@ nsresult NS_NewDOMXULCommandEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
nsInputEvent *aEvent)
|
||||
{
|
||||
nsDOMXULCommandEvent* it = new nsDOMXULCommandEvent(aPresContext, aEvent);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return CallQueryInterface(it, aInstancePtrResult);
|
||||
}
|
||||
|
@ -812,8 +812,8 @@ nsEventDispatcher::CreateEvent(nsPresContext* aPresContext,
|
||||
return NS_NewDOMTextEvent(aDOMEvent, aPresContext, nsnull);
|
||||
if (aEventType.LowerCaseEqualsLiteral("popupblockedevents"))
|
||||
return NS_NewDOMPopupBlockedEvent(aDOMEvent, aPresContext, nsnull);
|
||||
if (aEventType.LowerCaseEqualsLiteral("orientation"))
|
||||
return NS_NewDOMOrientationEvent(aDOMEvent, aPresContext, nsnull);
|
||||
if (aEventType.LowerCaseEqualsLiteral("deviceorientationevent"))
|
||||
return NS_NewDOMDeviceOrientationEvent(aDOMEvent, aPresContext, nsnull);
|
||||
if (aEventType.LowerCaseEqualsLiteral("uievent") ||
|
||||
aEventType.LowerCaseEqualsLiteral("uievents"))
|
||||
return NS_NewDOMUIEvent(aDOMEvent, aPresContext, nsnull);
|
||||
|
@ -503,7 +503,7 @@ nsEventListenerManager::AddEventListener(nsIDOMEventListener *aListener,
|
||||
kAllMutationBits :
|
||||
MutationBitForEventType(aType));
|
||||
}
|
||||
} else if (aTypeAtom == nsGkAtoms::onMozOrientation) {
|
||||
} else if (aTypeAtom == nsGkAtoms::ondeviceorientation) {
|
||||
nsPIDOMWindow* window = GetInnerWindowForTarget();
|
||||
if (window)
|
||||
window->SetHasOrientationEventListener();
|
||||
|
@ -118,7 +118,6 @@
|
||||
#include "nsIDOMMouseScrollEvent.h"
|
||||
#include "nsIDOMDragEvent.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMDocumentView.h"
|
||||
#include "nsIDOMNSUIEvent.h"
|
||||
#include "nsDOMDragEvent.h"
|
||||
#include "nsIDOMNSEditableElement.h"
|
||||
|
@ -101,6 +101,7 @@ _TEST_FILES = \
|
||||
test_bug624127.html \
|
||||
test_bug641477.html \
|
||||
test_bug648573.html \
|
||||
test_bug615597.html \
|
||||
$(NULL)
|
||||
|
||||
#bug 585630
|
||||
|
43
content/events/test/test_bug615597.html
Normal file
43
content/events/test/test_bug615597.html
Normal file
@ -0,0 +1,43 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=615597
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 615597</title>
|
||||
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=615597">Mozilla Bug 615597</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 615597 **/
|
||||
|
||||
window.addEventListener("deviceorientation", function(event) {
|
||||
is(event.alpha, 1.5);
|
||||
is(event.beta, 2.25);
|
||||
is(event.gamma, 3.667);
|
||||
is(event.absolute, true);
|
||||
is(event.compassCalibrated, true);
|
||||
SimpleTest.finish();
|
||||
}, true);
|
||||
|
||||
var event = DeviceOrientationEvent;
|
||||
ok(!!event, "Should have seen DeviceOrientationEvent!");
|
||||
|
||||
event = document.createEvent("DeviceOrientationEvent");
|
||||
event.initDeviceOrientationEvent('deviceorientation', true, true, 1.5, 2.25, 3.667, true);
|
||||
window.dispatchEvent(event);
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -1388,6 +1388,12 @@ nsHTMLDocument::NormalizeDocument()
|
||||
return nsDocument::NormalizeDocument();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLDocument::GetDefaultView(nsIDOMWindow** aWindow)
|
||||
{
|
||||
return nsDocument::GetDefaultView(aWindow);
|
||||
}
|
||||
|
||||
//
|
||||
// nsIDOMHTMLDocument interface implementation
|
||||
//
|
||||
|
@ -39,7 +39,7 @@
|
||||
#ifndef VideoUtils_h
|
||||
#define VideoUtils_h
|
||||
|
||||
#include "mozilla/Monitor.h"
|
||||
#include "mozilla/ReentrantMonitor.h"
|
||||
|
||||
// This file contains stuff we'd rather put elsewhere, but which is
|
||||
// dependent on other changes which we don't want to wait for. We plan to
|
||||
@ -64,13 +64,13 @@
|
||||
namespace mozilla {
|
||||
|
||||
/**
|
||||
* MonitorAutoExit
|
||||
* Exit the Monitor when it enters scope, and enters it when it leaves
|
||||
* ReentrantMonitorAutoExit
|
||||
* Exit the ReentrantMonitor when it enters scope, and enters it when it leaves
|
||||
* scope.
|
||||
*
|
||||
* MUCH PREFERRED to bare calls to Monitor.Exit and Enter.
|
||||
* MUCH PREFERRED to bare calls to ReentrantMonitor.Exit and Enter.
|
||||
*/
|
||||
class NS_STACK_CLASS MonitorAutoExit
|
||||
class NS_STACK_CLASS ReentrantMonitorAutoExit
|
||||
{
|
||||
public:
|
||||
/**
|
||||
@ -79,31 +79,30 @@ public:
|
||||
* acquires the lock. The lock must be held before constructing
|
||||
* this object!
|
||||
*
|
||||
* @param aMonitor A valid mozilla::Monitor* returned by
|
||||
* mozilla::Monitor::NewMonitor. It must be
|
||||
* already locked.
|
||||
* @param aReentrantMonitor A valid mozilla::ReentrantMonitor*. It
|
||||
* must be already locked.
|
||||
**/
|
||||
MonitorAutoExit(mozilla::Monitor &aMonitor) :
|
||||
mMonitor(&aMonitor)
|
||||
ReentrantMonitorAutoExit(ReentrantMonitor& aReentrantMonitor) :
|
||||
mReentrantMonitor(&aReentrantMonitor)
|
||||
{
|
||||
NS_ASSERTION(mMonitor, "null monitor");
|
||||
mMonitor->AssertCurrentThreadIn();
|
||||
mMonitor->Exit();
|
||||
NS_ASSERTION(mReentrantMonitor, "null monitor");
|
||||
mReentrantMonitor->AssertCurrentThreadIn();
|
||||
mReentrantMonitor->Exit();
|
||||
}
|
||||
|
||||
~MonitorAutoExit(void)
|
||||
~ReentrantMonitorAutoExit(void)
|
||||
{
|
||||
mMonitor->Enter();
|
||||
mReentrantMonitor->Enter();
|
||||
}
|
||||
|
||||
private:
|
||||
MonitorAutoExit();
|
||||
MonitorAutoExit(const MonitorAutoExit&);
|
||||
MonitorAutoExit& operator =(const MonitorAutoExit&);
|
||||
ReentrantMonitorAutoExit();
|
||||
ReentrantMonitorAutoExit(const ReentrantMonitorAutoExit&);
|
||||
ReentrantMonitorAutoExit& operator =(const ReentrantMonitorAutoExit&);
|
||||
static void* operator new(size_t) CPP_THROW_NEW;
|
||||
static void operator delete(void*);
|
||||
|
||||
mozilla::Monitor* mMonitor;
|
||||
ReentrantMonitor* mReentrantMonitor;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -84,7 +84,7 @@ nsAudioAvailableEventManager::nsAudioAvailableEventManager(nsBuiltinDecoder* aDe
|
||||
mSignalBufferLength(mDecoder->GetFrameBufferLength()),
|
||||
mNewSignalBufferLength(mSignalBufferLength),
|
||||
mSignalBufferPosition(0),
|
||||
mMonitor("media.audioavailableeventmanager")
|
||||
mReentrantMonitor("media.audioavailableeventmanager")
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsAudioAvailableEventManager);
|
||||
}
|
||||
@ -102,7 +102,7 @@ void nsAudioAvailableEventManager::Init(PRUint32 aChannels, PRUint32 aRate)
|
||||
|
||||
void nsAudioAvailableEventManager::DispatchPendingEvents(PRUint64 aCurrentTime)
|
||||
{
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
|
||||
while (mPendingEvents.Length() > 0) {
|
||||
nsAudioAvailableEventRunner* e =
|
||||
@ -120,7 +120,7 @@ void nsAudioAvailableEventManager::QueueWrittenAudioData(SoundDataValue* aAudioD
|
||||
PRUint32 aAudioDataLength,
|
||||
PRUint64 aEndTimeSampleOffset)
|
||||
{
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
|
||||
PRUint32 currentBufferSize = mNewSignalBufferLength;
|
||||
if (currentBufferSize == 0) {
|
||||
@ -202,7 +202,7 @@ void nsAudioAvailableEventManager::QueueWrittenAudioData(SoundDataValue* aAudioD
|
||||
|
||||
void nsAudioAvailableEventManager::Clear()
|
||||
{
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
|
||||
mPendingEvents.Clear();
|
||||
mSignalBufferPosition = 0;
|
||||
@ -210,7 +210,7 @@ void nsAudioAvailableEventManager::Clear()
|
||||
|
||||
void nsAudioAvailableEventManager::Drain(PRUint64 aEndTime)
|
||||
{
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
|
||||
// Force all pending events to go now.
|
||||
for (PRUint32 i = 0; i < mPendingEvents.Length(); ++i) {
|
||||
@ -240,7 +240,7 @@ void nsAudioAvailableEventManager::Drain(PRUint64 aEndTime)
|
||||
|
||||
void nsAudioAvailableEventManager::SetSignalBufferLength(PRUint32 aLength)
|
||||
{
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
|
||||
mNewSignalBufferLength = aLength;
|
||||
}
|
||||
|
@ -105,8 +105,9 @@ private:
|
||||
// between the state machine and audio threads.
|
||||
nsTArray< nsCOMPtr<nsIRunnable> > mPendingEvents;
|
||||
|
||||
// Monitor for shared access to mPendingEvents queue or buffer length.
|
||||
Monitor mMonitor;
|
||||
// ReentrantMonitor for shared access to mPendingEvents queue or
|
||||
// buffer length.
|
||||
ReentrantMonitor mReentrantMonitor;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -40,7 +40,6 @@
|
||||
#include "mozilla/dom/ContentChild.h"
|
||||
#include "mozilla/dom/PAudioChild.h"
|
||||
#include "mozilla/dom/AudioChild.h"
|
||||
#include "mozilla/Monitor.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
using namespace mozilla::dom;
|
||||
|
||||
|
@ -61,7 +61,7 @@ NS_IMPL_THREADSAFE_ISUPPORTS1(nsBuiltinDecoder, nsIObserver)
|
||||
void nsBuiltinDecoder::Pause()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
if (mPlayState == PLAY_STATE_SEEKING || mPlayState == PLAY_STATE_ENDED) {
|
||||
mNextState = PLAY_STATE_PAUSED;
|
||||
return;
|
||||
@ -96,7 +96,7 @@ nsBuiltinDecoder::nsBuiltinDecoder() :
|
||||
mRequestedSeekTime(-1.0),
|
||||
mDuration(-1),
|
||||
mSeekable(PR_TRUE),
|
||||
mMonitor("media.decoder"),
|
||||
mReentrantMonitor("media.decoder"),
|
||||
mPlayState(PLAY_STATE_PAUSED),
|
||||
mNextState(PLAY_STATE_PAUSED),
|
||||
mResourceLoaded(PR_FALSE),
|
||||
@ -195,7 +195,7 @@ nsresult nsBuiltinDecoder::Load(nsMediaStream* aStream,
|
||||
// Hold the lock while we do this to set proper lock ordering
|
||||
// expectations for dynamic deadlock detectors: decoder lock(s)
|
||||
// should be grabbed before the cache lock
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
|
||||
nsresult rv = aStream->Open(aStreamListener);
|
||||
if (NS_FAILED(rv)) {
|
||||
@ -217,7 +217,7 @@ nsresult nsBuiltinDecoder::Load(nsMediaStream* aStream,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
{
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
mDecoderStateMachine->SetSeekable(mSeekable);
|
||||
mDecoderStateMachine->SetDuration(mDuration);
|
||||
|
||||
@ -237,7 +237,7 @@ nsresult nsBuiltinDecoder::RequestFrameBufferLength(PRUint32 aLength)
|
||||
nsresult res = nsMediaDecoder::RequestFrameBufferLength(aLength);
|
||||
NS_ENSURE_SUCCESS(res,res);
|
||||
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
if (mDecoderStateMachine) {
|
||||
mDecoderStateMachine->SetFrameBufferLength(aLength);
|
||||
}
|
||||
@ -259,7 +259,7 @@ nsresult nsBuiltinDecoder::StartStateMachineThread()
|
||||
nsresult nsBuiltinDecoder::Play()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
nsresult res = StartStateMachineThread();
|
||||
NS_ENSURE_SUCCESS(res,res);
|
||||
if (mPlayState == PLAY_STATE_SEEKING) {
|
||||
@ -276,7 +276,7 @@ nsresult nsBuiltinDecoder::Play()
|
||||
nsresult nsBuiltinDecoder::Seek(double aTime)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
|
||||
if (aTime < 0.0)
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -356,7 +356,7 @@ void nsBuiltinDecoder::MetadataLoaded(PRUint32 aChannels,
|
||||
// to fulfill a seek, otherwise we'll get multiple metadataloaded events.
|
||||
PRBool notifyElement = PR_TRUE;
|
||||
{
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
mDuration = mDecoderStateMachine ? mDecoderStateMachine->GetDuration() : -1;
|
||||
// Duration has changed so we should recompute playback rate
|
||||
UpdatePlaybackRate();
|
||||
@ -382,7 +382,7 @@ void nsBuiltinDecoder::MetadataLoaded(PRUint32 aChannels,
|
||||
|
||||
// Only inform the element of FirstFrameLoaded if not doing a load() in order
|
||||
// to fulfill a seek, otherwise we'll get multiple loadedfirstframe events.
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
PRBool resourceIsLoaded = !mResourceLoaded && mStream &&
|
||||
mStream->IsDataCachedToEndOfStream(mDecoderPosition);
|
||||
if (mElement && notifyElement) {
|
||||
@ -421,7 +421,7 @@ void nsBuiltinDecoder::ResourceLoaded()
|
||||
{
|
||||
// If we are seeking or loading then the resource loaded notification we get
|
||||
// should be ignored, since it represents the end of the seek request.
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
if (mIgnoreProgressData || mResourceLoaded || mPlayState == PLAY_STATE_LOADING)
|
||||
return;
|
||||
|
||||
@ -504,7 +504,7 @@ nsBuiltinDecoder::GetStatistics()
|
||||
"Should be on main or state machine thread.");
|
||||
Statistics result;
|
||||
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
if (mStream) {
|
||||
result.mDownloadRate =
|
||||
mStream->GetDownloadRate(&result.mDownloadRateReliable);
|
||||
@ -531,7 +531,7 @@ nsBuiltinDecoder::GetStatistics()
|
||||
|
||||
double nsBuiltinDecoder::ComputePlaybackRate(PRPackedBool* aReliable)
|
||||
{
|
||||
GetMonitor().AssertCurrentThreadIn();
|
||||
GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
NS_ASSERTION(NS_IsMainThread() || IsCurrentThread(mStateMachineThread),
|
||||
"Should be on main or state machine thread.");
|
||||
|
||||
@ -547,7 +547,7 @@ void nsBuiltinDecoder::UpdatePlaybackRate()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread() || IsCurrentThread(mStateMachineThread),
|
||||
"Should be on main or state machine thread.");
|
||||
GetMonitor().AssertCurrentThreadIn();
|
||||
GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
if (!mStream)
|
||||
return;
|
||||
PRPackedBool reliable;
|
||||
@ -594,7 +594,7 @@ void nsBuiltinDecoder::NotifyDownloadEnded(nsresult aStatus)
|
||||
}
|
||||
|
||||
{
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
UpdatePlaybackRate();
|
||||
}
|
||||
|
||||
@ -609,7 +609,7 @@ void nsBuiltinDecoder::NotifyDownloadEnded(nsresult aStatus)
|
||||
|
||||
void nsBuiltinDecoder::NotifyBytesConsumed(PRInt64 aBytes)
|
||||
{
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
NS_ASSERTION(OnStateMachineThread() || mDecoderStateMachine->OnDecodeThread(),
|
||||
"Should be on play state machine or decode thread.");
|
||||
if (!mIgnoreProgressData) {
|
||||
@ -663,7 +663,7 @@ void nsBuiltinDecoder::SeekingStopped()
|
||||
|
||||
PRBool seekWasAborted = PR_FALSE;
|
||||
{
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
|
||||
// An additional seek was requested while the current seek was
|
||||
// in operation.
|
||||
@ -696,7 +696,7 @@ void nsBuiltinDecoder::SeekingStoppedAtEnd()
|
||||
PRBool fireEnded = PR_FALSE;
|
||||
PRBool seekWasAborted = PR_FALSE;
|
||||
{
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
|
||||
// An additional seek was requested while the current seek was
|
||||
// in operation.
|
||||
@ -736,14 +736,14 @@ void nsBuiltinDecoder::SeekingStarted()
|
||||
void nsBuiltinDecoder::ChangeState(PlayState aState)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
|
||||
if (mNextState == aState) {
|
||||
mNextState = PLAY_STATE_PAUSED;
|
||||
}
|
||||
|
||||
if (mPlayState == PLAY_STATE_SHUTDOWN) {
|
||||
mMonitor.NotifyAll();
|
||||
mReentrantMonitor.NotifyAll();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -772,7 +772,7 @@ void nsBuiltinDecoder::ChangeState(PlayState aState)
|
||||
/* No action needed */
|
||||
break;
|
||||
}
|
||||
mMonitor.NotifyAll();
|
||||
mReentrantMonitor.NotifyAll();
|
||||
}
|
||||
|
||||
void nsBuiltinDecoder::PlaybackPositionChanged()
|
||||
@ -786,7 +786,7 @@ void nsBuiltinDecoder::PlaybackPositionChanged()
|
||||
// Control the scope of the monitor so it is not
|
||||
// held while the timeupdate and the invalidate is run.
|
||||
{
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
if (mDecoderStateMachine) {
|
||||
mCurrentTime = mDecoderStateMachine->GetCurrentTime();
|
||||
mDecoderStateMachine->ClearPositionChangeFlag();
|
||||
@ -807,7 +807,7 @@ void nsBuiltinDecoder::PlaybackPositionChanged()
|
||||
void nsBuiltinDecoder::DurationChanged()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
PRInt64 oldDuration = mDuration;
|
||||
mDuration = mDecoderStateMachine ? mDecoderStateMachine->GetDuration() : -1;
|
||||
// Duration has changed so we should recompute playback rate
|
||||
@ -824,7 +824,7 @@ void nsBuiltinDecoder::SetDuration(double aDuration)
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
mDuration = static_cast<PRInt64>(NS_round(aDuration * static_cast<double>(USECS_PER_S)));
|
||||
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
if (mDecoderStateMachine) {
|
||||
mDecoderStateMachine->SetDuration(mDuration);
|
||||
}
|
||||
@ -838,7 +838,7 @@ void nsBuiltinDecoder::SetSeekable(PRBool aSeekable)
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
mSeekable = aSeekable;
|
||||
if (mDecoderStateMachine) {
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
mDecoderStateMachine->SetSeekable(aSeekable);
|
||||
}
|
||||
}
|
||||
@ -864,7 +864,7 @@ void nsBuiltinDecoder::Resume(PRBool aForceBuffering)
|
||||
mStream->Resume();
|
||||
}
|
||||
if (aForceBuffering) {
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
mDecoderStateMachine->StartBuffering();
|
||||
}
|
||||
}
|
||||
@ -898,6 +898,6 @@ void nsBuiltinDecoder::MoveLoadsToBackground()
|
||||
|
||||
void nsBuiltinDecoder::UpdatePlaybackOffset(PRInt64 aOffset)
|
||||
{
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
mPlaybackPosition = NS_MAX(aOffset, mPlaybackPosition);
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ Shutdown when destroying the nsBuiltinDecoder object.
|
||||
#include "nsMediaStream.h"
|
||||
#include "nsMediaDecoder.h"
|
||||
#include "nsHTMLMediaElement.h"
|
||||
#include "mozilla/Monitor.h"
|
||||
#include "mozilla/ReentrantMonitor.h"
|
||||
|
||||
class nsAudioStream;
|
||||
|
||||
@ -319,7 +319,7 @@ class nsBuiltinDecoder : public nsMediaDecoder
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
||||
public:
|
||||
typedef mozilla::Monitor Monitor;
|
||||
typedef mozilla::ReentrantMonitor ReentrantMonitor;
|
||||
|
||||
// Enumeration for the valid play states (see mPlayState)
|
||||
enum PlayState {
|
||||
@ -434,8 +434,8 @@ class nsBuiltinDecoder : public nsMediaDecoder
|
||||
|
||||
// Returns the monitor for other threads to synchronise access to
|
||||
// state.
|
||||
Monitor& GetMonitor() {
|
||||
return mMonitor;
|
||||
ReentrantMonitor& GetReentrantMonitor() {
|
||||
return mReentrantMonitor;
|
||||
}
|
||||
|
||||
// Constructs the time ranges representing what segments of the media
|
||||
@ -594,7 +594,7 @@ public:
|
||||
|
||||
// Position to seek to when the seek notification is received by the
|
||||
// decode thread. Written by the main thread and read via the
|
||||
// decode thread. Synchronised using mMonitor. If the
|
||||
// decode thread. Synchronised using mReentrantMonitor. If the
|
||||
// value is negative then no seek has been requested. When a seek is
|
||||
// started this is reset to negative.
|
||||
double mRequestedSeekTime;
|
||||
@ -622,13 +622,13 @@ public:
|
||||
// Stream of media data.
|
||||
nsAutoPtr<nsMediaStream> mStream;
|
||||
|
||||
// Monitor for detecting when the video play state changes. A call
|
||||
// ReentrantMonitor for detecting when the video play state changes. A call
|
||||
// to Wait on this monitor will block the thread until the next
|
||||
// state change.
|
||||
Monitor mMonitor;
|
||||
ReentrantMonitor mReentrantMonitor;
|
||||
|
||||
// Set to one of the valid play states. It is protected by the
|
||||
// monitor mMonitor. This monitor must be acquired when reading or
|
||||
// monitor mReentrantMonitor. This monitor must be acquired when reading or
|
||||
// writing the state. Any change to the state on the main thread
|
||||
// must call NotifyAll on the monitor so the decode thread can wake up.
|
||||
PlayState mPlayState;
|
||||
|
@ -207,7 +207,7 @@ VideoData* VideoData::Create(nsVideoInfo& aInfo,
|
||||
}
|
||||
|
||||
nsBuiltinDecoderReader::nsBuiltinDecoderReader(nsBuiltinDecoder* aDecoder)
|
||||
: mMonitor("media.decoderreader"),
|
||||
: mReentrantMonitor("media.decoderreader"),
|
||||
mDecoder(aDecoder)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsBuiltinDecoderReader);
|
||||
@ -279,7 +279,7 @@ Data* nsBuiltinDecoderReader::DecodeToFirstData(DecodeFn aDecodeFn,
|
||||
PRBool eof = PR_FALSE;
|
||||
while (!eof && aQueue.GetSize() == 0) {
|
||||
{
|
||||
MonitorAutoEnter decoderMon(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoEnter decoderMon(mDecoder->GetReentrantMonitor());
|
||||
if (mDecoder->GetDecodeState() == nsDecoderStateMachine::DECODER_STATE_SHUTDOWN) {
|
||||
return nsnull;
|
||||
}
|
||||
@ -301,8 +301,8 @@ nsresult nsBuiltinDecoderReader::DecodeToTarget(PRInt64 aTarget)
|
||||
PRBool skip = PR_FALSE;
|
||||
eof = !DecodeVideoFrame(skip, 0);
|
||||
{
|
||||
MonitorAutoExit exitReaderMon(mMonitor);
|
||||
MonitorAutoEnter decoderMon(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoExit exitReaderMon(mReentrantMonitor);
|
||||
ReentrantMonitorAutoEnter decoderMon(mDecoder->GetReentrantMonitor());
|
||||
if (mDecoder->GetDecodeState() == nsBuiltinDecoderStateMachine::DECODER_STATE_SHUTDOWN) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
@ -326,8 +326,8 @@ nsresult nsBuiltinDecoderReader::DecodeToTarget(PRInt64 aTarget)
|
||||
}
|
||||
}
|
||||
{
|
||||
MonitorAutoExit exitReaderMon(mMonitor);
|
||||
MonitorAutoEnter decoderMon(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoExit exitReaderMon(mReentrantMonitor);
|
||||
ReentrantMonitorAutoEnter decoderMon(mDecoder->GetReentrantMonitor());
|
||||
if (mDecoder->GetDecodeState() == nsBuiltinDecoderStateMachine::DECODER_STATE_SHUTDOWN) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
@ -342,8 +342,8 @@ nsresult nsBuiltinDecoderReader::DecodeToTarget(PRInt64 aTarget)
|
||||
while (!eof && mAudioQueue.GetSize() == 0) {
|
||||
eof = !DecodeAudioData();
|
||||
{
|
||||
MonitorAutoExit exitReaderMon(mMonitor);
|
||||
MonitorAutoEnter decoderMon(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoExit exitReaderMon(mReentrantMonitor);
|
||||
ReentrantMonitorAutoEnter decoderMon(mDecoder->GetReentrantMonitor());
|
||||
if (mDecoder->GetDecodeState() == nsBuiltinDecoderStateMachine::DECODER_STATE_SHUTDOWN) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "nsSize.h"
|
||||
#include "nsRect.h"
|
||||
#include "mozilla/Monitor.h"
|
||||
#include "mozilla/ReentrantMonitor.h"
|
||||
|
||||
class nsBuiltinDecoderStateMachine;
|
||||
|
||||
@ -297,12 +297,12 @@ class MediaQueueDeallocator : public nsDequeFunctor {
|
||||
|
||||
template <class T> class MediaQueue : private nsDeque {
|
||||
public:
|
||||
typedef mozilla::MonitorAutoEnter MonitorAutoEnter;
|
||||
typedef mozilla::Monitor Monitor;
|
||||
typedef mozilla::ReentrantMonitorAutoEnter ReentrantMonitorAutoEnter;
|
||||
typedef mozilla::ReentrantMonitor ReentrantMonitor;
|
||||
|
||||
MediaQueue()
|
||||
: nsDeque(new MediaQueueDeallocator<T>()),
|
||||
mMonitor("mediaqueue"),
|
||||
mReentrantMonitor("mediaqueue"),
|
||||
mEndOfStream(0)
|
||||
{}
|
||||
|
||||
@ -311,52 +311,52 @@ template <class T> class MediaQueue : private nsDeque {
|
||||
}
|
||||
|
||||
inline PRInt32 GetSize() {
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
return nsDeque::GetSize();
|
||||
}
|
||||
|
||||
inline void Push(T* aItem) {
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
nsDeque::Push(aItem);
|
||||
}
|
||||
|
||||
inline void PushFront(T* aItem) {
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
nsDeque::PushFront(aItem);
|
||||
}
|
||||
|
||||
inline T* Pop() {
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
return static_cast<T*>(nsDeque::Pop());
|
||||
}
|
||||
|
||||
inline T* PopFront() {
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
return static_cast<T*>(nsDeque::PopFront());
|
||||
}
|
||||
|
||||
inline T* Peek() {
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
return static_cast<T*>(nsDeque::Peek());
|
||||
}
|
||||
|
||||
inline T* PeekFront() {
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
return static_cast<T*>(nsDeque::PeekFront());
|
||||
}
|
||||
|
||||
inline void Empty() {
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
nsDeque::Empty();
|
||||
}
|
||||
|
||||
inline void Erase() {
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
nsDeque::Erase();
|
||||
}
|
||||
|
||||
void Reset() {
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
while (GetSize() > 0) {
|
||||
T* x = PopFront();
|
||||
delete x;
|
||||
@ -365,7 +365,7 @@ template <class T> class MediaQueue : private nsDeque {
|
||||
}
|
||||
|
||||
PRBool AtEndOfStream() {
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
return GetSize() == 0 && mEndOfStream;
|
||||
}
|
||||
|
||||
@ -373,19 +373,19 @@ template <class T> class MediaQueue : private nsDeque {
|
||||
// This happens when the media stream has been completely decoded. Note this
|
||||
// does not mean that the corresponding stream has finished playback.
|
||||
PRBool IsFinished() {
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
return mEndOfStream;
|
||||
}
|
||||
|
||||
// Informs the media queue that it won't be receiving any more samples.
|
||||
void Finish() {
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
mEndOfStream = PR_TRUE;
|
||||
}
|
||||
|
||||
// Returns the approximate number of microseconds of samples in the queue.
|
||||
PRInt64 Duration() {
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
if (GetSize() < 2) {
|
||||
return 0;
|
||||
}
|
||||
@ -395,7 +395,7 @@ template <class T> class MediaQueue : private nsDeque {
|
||||
}
|
||||
|
||||
private:
|
||||
Monitor mMonitor;
|
||||
ReentrantMonitor mReentrantMonitor;
|
||||
|
||||
// PR_TRUE when we've decoded the last frame of data in the
|
||||
// bitstream for which we're queueing sample-data.
|
||||
@ -410,8 +410,8 @@ private:
|
||||
// this class.
|
||||
class nsBuiltinDecoderReader : public nsRunnable {
|
||||
public:
|
||||
typedef mozilla::Monitor Monitor;
|
||||
typedef mozilla::MonitorAutoEnter MonitorAutoEnter;
|
||||
typedef mozilla::ReentrantMonitor ReentrantMonitor;
|
||||
typedef mozilla::ReentrantMonitorAutoEnter ReentrantMonitorAutoEnter;
|
||||
|
||||
nsBuiltinDecoderReader(nsBuiltinDecoder* aDecoder);
|
||||
~nsBuiltinDecoderReader();
|
||||
@ -503,7 +503,7 @@ protected:
|
||||
|
||||
// The lock which we hold whenever we read or decode. This ensures the thread
|
||||
// safety of the reader and its data fields.
|
||||
Monitor mMonitor;
|
||||
ReentrantMonitor mReentrantMonitor;
|
||||
|
||||
// Reference to the owning decoder object. Do not hold the
|
||||
// reader's monitor when accessing this.
|
||||
|
@ -175,7 +175,7 @@ nsBuiltinDecoderStateMachine::nsBuiltinDecoderStateMachine(nsBuiltinDecoder* aDe
|
||||
nsBuiltinDecoderReader* aReader) :
|
||||
mDecoder(aDecoder),
|
||||
mState(DECODER_STATE_DECODING_METADATA),
|
||||
mAudioMonitor("media.audiostream"),
|
||||
mAudioReentrantMonitor("media.audiostream"),
|
||||
mCbCrSize(0),
|
||||
mPlayDuration(0),
|
||||
mStartTime(-1),
|
||||
@ -204,7 +204,7 @@ nsBuiltinDecoderStateMachine::~nsBuiltinDecoderStateMachine()
|
||||
}
|
||||
|
||||
PRBool nsBuiltinDecoderStateMachine::HasFutureAudio() const {
|
||||
mDecoder->GetMonitor().AssertCurrentThreadIn();
|
||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
NS_ASSERTION(HasAudio(), "Should only call HasFutureAudio() when we have audio");
|
||||
// We've got audio ready to play if:
|
||||
// 1. We've not completed playback of audio, and
|
||||
@ -216,14 +216,14 @@ PRBool nsBuiltinDecoderStateMachine::HasFutureAudio() const {
|
||||
}
|
||||
|
||||
PRBool nsBuiltinDecoderStateMachine::HaveNextFrameData() const {
|
||||
mDecoder->GetMonitor().AssertCurrentThreadIn();
|
||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
return (!HasAudio() || HasFutureAudio()) &&
|
||||
(!HasVideo() || mReader->mVideoQueue.GetSize() > 0);
|
||||
}
|
||||
|
||||
PRInt64 nsBuiltinDecoderStateMachine::GetDecodedAudioDuration() {
|
||||
NS_ASSERTION(OnDecodeThread(), "Should be on decode thread.");
|
||||
mDecoder->GetMonitor().AssertCurrentThreadIn();
|
||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
PRInt64 audioDecoded = mReader->mAudioQueue.Duration();
|
||||
if (mAudioEndTime != -1) {
|
||||
audioDecoded += mAudioEndTime - GetMediaTime();
|
||||
@ -267,7 +267,7 @@ void nsBuiltinDecoderStateMachine::DecodeLoop()
|
||||
MediaQueue<VideoData>& videoQueue = mReader->mVideoQueue;
|
||||
MediaQueue<SoundData>& audioQueue = mReader->mAudioQueue;
|
||||
|
||||
MonitorAutoEnter mon(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
|
||||
PRBool videoPlaying = HasVideo();
|
||||
PRBool audioPlaying = HasAudio();
|
||||
@ -323,7 +323,7 @@ void nsBuiltinDecoderStateMachine::DecodeLoop()
|
||||
TimeDuration decodeTime;
|
||||
{
|
||||
PRInt64 currentTime = GetMediaTime();
|
||||
MonitorAutoExit exitMon(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor());
|
||||
TimeStamp start = TimeStamp::Now();
|
||||
videoPlaying = mReader->DecodeVideoFrame(skipToNextKeyframe, currentTime);
|
||||
decodeTime = TimeStamp::Now() - start;
|
||||
@ -345,13 +345,13 @@ void nsBuiltinDecoderStateMachine::DecodeLoop()
|
||||
if (audioPlaying &&
|
||||
(GetDecodedAudioDuration() < ampleAudioThreshold || audioQueue.GetSize() == 0))
|
||||
{
|
||||
MonitorAutoExit exitMon(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor());
|
||||
audioPlaying = mReader->DecodeAudioData();
|
||||
}
|
||||
|
||||
// Notify to ensure that the AudioLoop() is not waiting, in case it was
|
||||
// waiting for more audio to be decoded.
|
||||
mDecoder->GetMonitor().NotifyAll();
|
||||
mDecoder->GetReentrantMonitor().NotifyAll();
|
||||
|
||||
if (!IsPlaying()) {
|
||||
// Update the ready state, so that the play DOM events fire. We only
|
||||
@ -387,7 +387,7 @@ void nsBuiltinDecoderStateMachine::DecodeLoop()
|
||||
mState != DECODER_STATE_SEEKING)
|
||||
{
|
||||
mState = DECODER_STATE_COMPLETED;
|
||||
mDecoder->GetMonitor().NotifyAll();
|
||||
mDecoder->GetReentrantMonitor().NotifyAll();
|
||||
}
|
||||
|
||||
LOG(PR_LOG_DEBUG, ("Shutting down DecodeLoop this=%p", this));
|
||||
@ -395,7 +395,7 @@ void nsBuiltinDecoderStateMachine::DecodeLoop()
|
||||
|
||||
PRBool nsBuiltinDecoderStateMachine::IsPlaying()
|
||||
{
|
||||
mDecoder->GetMonitor().AssertCurrentThreadIn();
|
||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
|
||||
return !mPlayStartTime.IsNull();
|
||||
}
|
||||
@ -412,7 +412,7 @@ void nsBuiltinDecoderStateMachine::AudioLoop()
|
||||
PRInt32 minWriteSamples = -1;
|
||||
PRInt64 samplesAtLastSleep = 0;
|
||||
{
|
||||
MonitorAutoEnter mon(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
mAudioCompleted = PR_FALSE;
|
||||
audioStartTime = mAudioStartTime;
|
||||
channels = mInfo.mAudioChannels;
|
||||
@ -424,7 +424,7 @@ void nsBuiltinDecoderStateMachine::AudioLoop()
|
||||
// Wait while we're not playing, and we're not shutting down, or we're
|
||||
// playing and we've got no audio to play.
|
||||
{
|
||||
MonitorAutoEnter mon(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
NS_ASSERTION(mState != DECODER_STATE_DECODING_METADATA,
|
||||
"Should have meta data before audio started playing.");
|
||||
while (mState != DECODER_STATE_SHUTDOWN &&
|
||||
@ -455,7 +455,7 @@ void nsBuiltinDecoderStateMachine::AudioLoop()
|
||||
}
|
||||
|
||||
if (setVolume || minWriteSamples == -1) {
|
||||
MonitorAutoEnter audioMon(mAudioMonitor);
|
||||
ReentrantMonitorAutoEnter audioMon(mAudioReentrantMonitor);
|
||||
if (mAudioStream) {
|
||||
if (setVolume) {
|
||||
mAudioStream->SetVolume(volume);
|
||||
@ -508,7 +508,7 @@ void nsBuiltinDecoderStateMachine::AudioLoop()
|
||||
audioDuration += PlayFromAudioQueue(sampleTime, channels);
|
||||
}
|
||||
{
|
||||
MonitorAutoEnter mon(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
PRInt64 playedUsecs;
|
||||
if (!SamplesToUsecs(audioDuration, rate, playedUsecs)) {
|
||||
NS_WARNING("Int overflow calculating playedUsecs");
|
||||
@ -545,14 +545,14 @@ void nsBuiltinDecoderStateMachine::AudioLoop()
|
||||
{
|
||||
// Last sample pushed to audio hardware, wait for the audio to finish,
|
||||
// before the audio thread terminates.
|
||||
MonitorAutoEnter audioMon(mAudioMonitor);
|
||||
ReentrantMonitorAutoEnter audioMon(mAudioReentrantMonitor);
|
||||
if (mAudioStream) {
|
||||
PRBool seeking = PR_FALSE;
|
||||
PRInt64 oldPosition = -1;
|
||||
|
||||
{
|
||||
MonitorAutoExit audioExit(mAudioMonitor);
|
||||
MonitorAutoEnter mon(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoExit audioExit(mAudioReentrantMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
PRInt64 position = GetMediaTime();
|
||||
while (oldPosition != position &&
|
||||
mAudioEndTime - position > 0 &&
|
||||
@ -579,12 +579,12 @@ void nsBuiltinDecoderStateMachine::AudioLoop()
|
||||
LOG(PR_LOG_DEBUG, ("%p Reached audio stream end.", mDecoder));
|
||||
}
|
||||
{
|
||||
MonitorAutoEnter mon(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
mAudioCompleted = PR_TRUE;
|
||||
UpdateReadyState();
|
||||
// Kick the decode and state machine threads; they may be sleeping waiting
|
||||
// for this to finish.
|
||||
mDecoder->GetMonitor().NotifyAll();
|
||||
mDecoder->GetReentrantMonitor().NotifyAll();
|
||||
}
|
||||
LOG(PR_LOG_DEBUG, ("Audio stream finished playing, audio thread exit"));
|
||||
}
|
||||
@ -594,7 +594,7 @@ PRUint32 nsBuiltinDecoderStateMachine::PlaySilence(PRUint32 aSamples,
|
||||
PRUint64 aSampleOffset)
|
||||
|
||||
{
|
||||
MonitorAutoEnter audioMon(mAudioMonitor);
|
||||
ReentrantMonitorAutoEnter audioMon(mAudioReentrantMonitor);
|
||||
if (!mAudioStream || mAudioStream->IsPaused()) {
|
||||
// The state machine has paused since we've released the decoder
|
||||
// monitor and acquired the audio monitor. Don't write any audio.
|
||||
@ -617,16 +617,16 @@ PRUint32 nsBuiltinDecoderStateMachine::PlayFromAudioQueue(PRUint64 aSampleOffset
|
||||
{
|
||||
nsAutoPtr<SoundData> sound(mReader->mAudioQueue.PopFront());
|
||||
{
|
||||
MonitorAutoEnter mon(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
NS_WARN_IF_FALSE(IsPlaying(), "Should be playing");
|
||||
// Awaken the decode loop if it's waiting for space to free up in the
|
||||
// audio queue.
|
||||
mDecoder->GetMonitor().NotifyAll();
|
||||
mDecoder->GetReentrantMonitor().NotifyAll();
|
||||
}
|
||||
PRInt64 offset = -1;
|
||||
PRUint32 samples = 0;
|
||||
{
|
||||
MonitorAutoEnter audioMon(mAudioMonitor);
|
||||
ReentrantMonitorAutoEnter audioMon(mAudioReentrantMonitor);
|
||||
if (!mAudioStream) {
|
||||
return 0;
|
||||
}
|
||||
@ -673,7 +673,7 @@ void nsBuiltinDecoderStateMachine::StopPlayback(eStopMode aMode)
|
||||
{
|
||||
NS_ASSERTION(IsCurrentThread(mDecoder->mStateMachineThread),
|
||||
"Should be on state machine thread.");
|
||||
mDecoder->GetMonitor().AssertCurrentThreadIn();
|
||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
|
||||
mDecoder->mPlaybackStatistics.Stop(TimeStamp::Now());
|
||||
|
||||
@ -687,8 +687,8 @@ void nsBuiltinDecoderStateMachine::StopPlayback(eStopMode aMode)
|
||||
mPlayStartTime = TimeStamp();
|
||||
}
|
||||
if (HasAudio()) {
|
||||
MonitorAutoExit exitMon(mDecoder->GetMonitor());
|
||||
MonitorAutoEnter audioMon(mAudioMonitor);
|
||||
ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor());
|
||||
ReentrantMonitorAutoEnter audioMon(mAudioReentrantMonitor);
|
||||
if (mAudioStream) {
|
||||
if (aMode == AUDIO_PAUSE) {
|
||||
mAudioStream->Pause();
|
||||
@ -706,7 +706,7 @@ void nsBuiltinDecoderStateMachine::StartPlayback()
|
||||
NS_ASSERTION(IsCurrentThread(mDecoder->mStateMachineThread),
|
||||
"Should be on state machine thread.");
|
||||
NS_ASSERTION(!IsPlaying(), "Shouldn't be playing when StartPlayback() is called");
|
||||
mDecoder->GetMonitor().AssertCurrentThreadIn();
|
||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
LOG(PR_LOG_DEBUG, ("%p StartPlayback", mDecoder));
|
||||
mDecoder->mPlaybackStatistics.Start(TimeStamp::Now());
|
||||
if (HasAudio()) {
|
||||
@ -714,8 +714,8 @@ void nsBuiltinDecoderStateMachine::StartPlayback()
|
||||
PRInt32 channels = mInfo.mAudioChannels;
|
||||
|
||||
{
|
||||
MonitorAutoExit exitMon(mDecoder->GetMonitor());
|
||||
MonitorAutoEnter audioMon(mAudioMonitor);
|
||||
ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor());
|
||||
ReentrantMonitorAutoEnter audioMon(mAudioReentrantMonitor);
|
||||
if (mAudioStream) {
|
||||
// We have an audiostream, so it must have been paused the last time
|
||||
// StopPlayback() was called.
|
||||
@ -729,14 +729,14 @@ void nsBuiltinDecoderStateMachine::StartPlayback()
|
||||
}
|
||||
}
|
||||
mPlayStartTime = TimeStamp::Now();
|
||||
mDecoder->GetMonitor().NotifyAll();
|
||||
mDecoder->GetReentrantMonitor().NotifyAll();
|
||||
}
|
||||
|
||||
void nsBuiltinDecoderStateMachine::UpdatePlaybackPositionInternal(PRInt64 aTime)
|
||||
{
|
||||
NS_ASSERTION(IsCurrentThread(mDecoder->mStateMachineThread),
|
||||
"Should be on state machine thread.");
|
||||
mDecoder->GetMonitor().AssertCurrentThreadIn();
|
||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
|
||||
NS_ASSERTION(mStartTime >= 0, "Should have positive mStartTime");
|
||||
mCurrentFrameTime = aTime - mStartTime;
|
||||
@ -769,14 +769,14 @@ void nsBuiltinDecoderStateMachine::UpdatePlaybackPosition(PRInt64 aTime)
|
||||
void nsBuiltinDecoderStateMachine::ClearPositionChangeFlag()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
mDecoder->GetMonitor().AssertCurrentThreadIn();
|
||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
|
||||
mPositionChangeQueued = PR_FALSE;
|
||||
}
|
||||
|
||||
nsHTMLMediaElement::NextFrameStatus nsBuiltinDecoderStateMachine::GetNextFrameStatus()
|
||||
{
|
||||
MonitorAutoEnter mon(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
if (IsBuffering() || IsSeeking()) {
|
||||
return nsHTMLMediaElement::NEXT_FRAME_UNAVAILABLE_BUFFERING;
|
||||
} else if (HaveNextFrameData()) {
|
||||
@ -788,7 +788,7 @@ nsHTMLMediaElement::NextFrameStatus nsBuiltinDecoderStateMachine::GetNextFrameSt
|
||||
void nsBuiltinDecoderStateMachine::SetVolume(double volume)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MonitorAutoEnter mon(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
mVolume = volume;
|
||||
}
|
||||
|
||||
@ -804,7 +804,7 @@ double nsBuiltinDecoderStateMachine::GetCurrentTime() const
|
||||
|
||||
PRInt64 nsBuiltinDecoderStateMachine::GetDuration()
|
||||
{
|
||||
mDecoder->GetMonitor().AssertCurrentThreadIn();
|
||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
|
||||
if (mEndTime == -1 || mStartTime == -1)
|
||||
return -1;
|
||||
@ -815,7 +815,7 @@ void nsBuiltinDecoderStateMachine::SetDuration(PRInt64 aDuration)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread() || mDecoder->OnStateMachineThread(),
|
||||
"Should be on main or state machine thread.");
|
||||
mDecoder->GetMonitor().AssertCurrentThreadIn();
|
||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
|
||||
if (mStartTime != -1) {
|
||||
mEndTime = mStartTime + aDuration;
|
||||
@ -828,7 +828,7 @@ void nsBuiltinDecoderStateMachine::SetDuration(PRInt64 aDuration)
|
||||
void nsBuiltinDecoderStateMachine::SetSeekable(PRBool aSeekable)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
mDecoder->GetMonitor().AssertCurrentThreadIn();
|
||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
|
||||
mSeekable = aSeekable;
|
||||
}
|
||||
@ -838,20 +838,20 @@ void nsBuiltinDecoderStateMachine::Shutdown()
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
|
||||
// Once we've entered the shutdown state here there's no going back.
|
||||
MonitorAutoEnter mon(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
|
||||
// Change state before issuing shutdown request to threads so those
|
||||
// threads can start exiting cleanly during the Shutdown call.
|
||||
LOG(PR_LOG_DEBUG, ("%p Changed state to SHUTDOWN", mDecoder));
|
||||
mState = DECODER_STATE_SHUTDOWN;
|
||||
mDecoder->GetMonitor().NotifyAll();
|
||||
mDecoder->GetReentrantMonitor().NotifyAll();
|
||||
}
|
||||
|
||||
void nsBuiltinDecoderStateMachine::StartDecoding()
|
||||
{
|
||||
NS_ASSERTION(IsCurrentThread(mDecoder->mStateMachineThread),
|
||||
"Should be on state machine thread.");
|
||||
MonitorAutoEnter mon(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
if (mState != DECODER_STATE_DECODING) {
|
||||
mDecodeStartTime = TimeStamp::Now();
|
||||
}
|
||||
@ -864,12 +864,12 @@ void nsBuiltinDecoderStateMachine::Play()
|
||||
// When asked to play, switch to decoding state only if
|
||||
// we are currently buffering. In other cases, we'll start playing anyway
|
||||
// when the state machine notices the decoder's state change to PLAYING.
|
||||
MonitorAutoEnter mon(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
if (mState == DECODER_STATE_BUFFERING) {
|
||||
LOG(PR_LOG_DEBUG, ("%p Changed state from BUFFERING to DECODING", mDecoder));
|
||||
mState = DECODER_STATE_DECODING;
|
||||
mDecodeStartTime = TimeStamp::Now();
|
||||
mDecoder->GetMonitor().NotifyAll();
|
||||
mDecoder->GetReentrantMonitor().NotifyAll();
|
||||
}
|
||||
}
|
||||
|
||||
@ -886,7 +886,7 @@ void nsBuiltinDecoderStateMachine::ResetPlayback()
|
||||
void nsBuiltinDecoderStateMachine::Seek(double aTime)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MonitorAutoEnter mon(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
// nsBuiltinDecoder::mPlayState should be SEEKING while we seek, and
|
||||
// in that case nsBuiltinDecoder shouldn't be calling us.
|
||||
NS_ASSERTION(mState != DECODER_STATE_SEEKING,
|
||||
@ -916,19 +916,19 @@ void nsBuiltinDecoderStateMachine::StopDecodeThreads()
|
||||
{
|
||||
NS_ASSERTION(IsCurrentThread(mDecoder->mStateMachineThread),
|
||||
"Should be on state machine thread.");
|
||||
mDecoder->GetMonitor().AssertCurrentThreadIn();
|
||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
mStopDecodeThreads = PR_TRUE;
|
||||
mDecoder->GetMonitor().NotifyAll();
|
||||
mDecoder->GetReentrantMonitor().NotifyAll();
|
||||
if (mDecodeThread) {
|
||||
{
|
||||
MonitorAutoExit exitMon(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor());
|
||||
mDecodeThread->Shutdown();
|
||||
}
|
||||
mDecodeThread = nsnull;
|
||||
}
|
||||
if (mAudioThread) {
|
||||
{
|
||||
MonitorAutoExit exitMon(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor());
|
||||
mAudioThread->Shutdown();
|
||||
}
|
||||
mAudioThread = nsnull;
|
||||
@ -940,7 +940,7 @@ nsBuiltinDecoderStateMachine::StartDecodeThreads()
|
||||
{
|
||||
NS_ASSERTION(IsCurrentThread(mDecoder->mStateMachineThread),
|
||||
"Should be on state machine thread.");
|
||||
mDecoder->GetMonitor().AssertCurrentThreadIn();
|
||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
mStopDecodeThreads = PR_FALSE;
|
||||
if (!mDecodeThread && mState < DECODER_STATE_COMPLETED) {
|
||||
nsresult rv = NS_NewThread(getter_AddRefs(mDecodeThread));
|
||||
@ -978,7 +978,7 @@ PRInt64 nsBuiltinDecoderStateMachine::AudioDecodedUsecs() const
|
||||
|
||||
PRBool nsBuiltinDecoderStateMachine::HasLowDecodedData(PRInt64 aAudioUsecs) const
|
||||
{
|
||||
mDecoder->GetMonitor().AssertCurrentThreadIn();
|
||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
// We consider ourselves low on decoded data if we're low on audio,
|
||||
// provided we've not decoded to the end of the audio stream, or
|
||||
// if we're only playing video and we're low on video frames, provided
|
||||
@ -1000,7 +1000,7 @@ PRBool nsBuiltinDecoderStateMachine::HasLowUndecodedData() const
|
||||
|
||||
PRInt64 nsBuiltinDecoderStateMachine::GetUndecodedData() const
|
||||
{
|
||||
mDecoder->GetMonitor().AssertCurrentThreadIn();
|
||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
NS_ASSERTION(mState > DECODER_STATE_DECODING_METADATA,
|
||||
"Must have loaded metadata for GetBuffered() to work");
|
||||
nsTimeRanges buffered;
|
||||
@ -1033,7 +1033,7 @@ void nsBuiltinDecoderStateMachine::SetFrameBufferLength(PRUint32 aLength)
|
||||
{
|
||||
NS_ASSERTION(aLength >= 512 && aLength <= 16384,
|
||||
"The length must be between 512 and 16384");
|
||||
mDecoder->GetMonitor().AssertCurrentThreadIn();
|
||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
mEventManager.SetSignalBufferLength(aLength);
|
||||
}
|
||||
|
||||
@ -1045,7 +1045,7 @@ nsresult nsBuiltinDecoderStateMachine::Run()
|
||||
NS_ENSURE_TRUE(stream, NS_ERROR_NULL_POINTER);
|
||||
|
||||
while (PR_TRUE) {
|
||||
MonitorAutoEnter mon(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
switch (mState) {
|
||||
case DECODER_STATE_SHUTDOWN:
|
||||
if (IsPlaying()) {
|
||||
@ -1068,7 +1068,7 @@ nsresult nsBuiltinDecoderStateMachine::Run()
|
||||
nsIntSize display = mInfo.mDisplay;
|
||||
float aspect = mInfo.mPixelAspectRatio;
|
||||
{
|
||||
MonitorAutoExit exitMon(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor());
|
||||
RenderVideoFrame(videoData, TimeStamp::Now(), display, aspect);
|
||||
}
|
||||
}
|
||||
@ -1157,7 +1157,7 @@ nsresult nsBuiltinDecoderStateMachine::Run()
|
||||
// inform the element and its users that we have no frames
|
||||
// to display
|
||||
{
|
||||
MonitorAutoExit exitMon(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor());
|
||||
nsCOMPtr<nsIRunnable> startEvent =
|
||||
NS_NewRunnableMethod(mDecoder, &nsBuiltinDecoder::SeekingStarted);
|
||||
NS_DispatchToMainThread(startEvent, NS_DISPATCH_SYNC);
|
||||
@ -1172,7 +1172,7 @@ nsresult nsBuiltinDecoderStateMachine::Run()
|
||||
ResetPlayback();
|
||||
nsresult res;
|
||||
{
|
||||
MonitorAutoExit exitMon(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor());
|
||||
// Now perform the seek. We must not hold the state machine monitor
|
||||
// while we seek, since the seek decodes.
|
||||
res = mReader->Seek(seekTime,
|
||||
@ -1196,7 +1196,7 @@ nsresult nsBuiltinDecoderStateMachine::Run()
|
||||
nsIntSize display = mInfo.mDisplay;
|
||||
float aspect = mInfo.mPixelAspectRatio;
|
||||
{
|
||||
MonitorAutoExit exitMon(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor());
|
||||
RenderVideoFrame(video, TimeStamp::Now(), display, aspect);
|
||||
}
|
||||
mReader->mVideoQueue.PopFront();
|
||||
@ -1230,10 +1230,10 @@ nsresult nsBuiltinDecoderStateMachine::Run()
|
||||
stopEvent = NS_NewRunnableMethod(mDecoder, &nsBuiltinDecoder::SeekingStopped);
|
||||
StartDecoding();
|
||||
}
|
||||
mDecoder->GetMonitor().NotifyAll();
|
||||
mDecoder->GetReentrantMonitor().NotifyAll();
|
||||
|
||||
{
|
||||
MonitorAutoExit exitMon(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor());
|
||||
NS_DispatchToMainThread(stopEvent, NS_DISPATCH_SYNC);
|
||||
}
|
||||
|
||||
@ -1248,7 +1248,7 @@ nsresult nsBuiltinDecoderStateMachine::Run()
|
||||
{
|
||||
if (IsPlaying()) {
|
||||
StopPlayback(AUDIO_PAUSE);
|
||||
mDecoder->GetMonitor().NotifyAll();
|
||||
mDecoder->GetReentrantMonitor().NotifyAll();
|
||||
}
|
||||
|
||||
TimeStamp now = TimeStamp::Now();
|
||||
@ -1285,7 +1285,7 @@ nsresult nsBuiltinDecoderStateMachine::Run()
|
||||
|
||||
if (mState != DECODER_STATE_BUFFERING) {
|
||||
// Notify to allow blocked decoder thread to continue
|
||||
mDecoder->GetMonitor().NotifyAll();
|
||||
mDecoder->GetReentrantMonitor().NotifyAll();
|
||||
UpdateReadyState();
|
||||
if (mDecoder->GetState() == nsBuiltinDecoder::PLAY_STATE_PLAYING) {
|
||||
if (!IsPlaying()) {
|
||||
@ -1329,7 +1329,7 @@ nsresult nsBuiltinDecoderStateMachine::Run()
|
||||
PRInt64 clockTime = NS_MAX(mEndTime, NS_MAX(videoTime, GetAudioClock()));
|
||||
UpdatePlaybackPosition(clockTime);
|
||||
{
|
||||
MonitorAutoExit exitMon(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor());
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
NS_NewRunnableMethod(mDecoder, &nsBuiltinDecoder::PlaybackEnded);
|
||||
NS_DispatchToMainThread(event, NS_DISPATCH_SYNC);
|
||||
@ -1359,7 +1359,7 @@ void nsBuiltinDecoderStateMachine::RenderVideoFrame(VideoData* aData,
|
||||
float aAspectRatio)
|
||||
{
|
||||
NS_ASSERTION(IsCurrentThread(mDecoder->mStateMachineThread), "Should be on state machine thread.");
|
||||
mDecoder->GetMonitor().AssertNotCurrentThreadIn();
|
||||
mDecoder->GetReentrantMonitor().AssertNotCurrentThreadIn();
|
||||
|
||||
if (aData->mDuplicate) {
|
||||
return;
|
||||
@ -1385,7 +1385,7 @@ nsBuiltinDecoderStateMachine::GetAudioClock()
|
||||
void nsBuiltinDecoderStateMachine::AdvanceFrame()
|
||||
{
|
||||
NS_ASSERTION(IsCurrentThread(mDecoder->mStateMachineThread), "Should be on state machine thread.");
|
||||
mDecoder->GetMonitor().AssertCurrentThreadIn();
|
||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
|
||||
// When it's time to display a frame, decode the frame and display it.
|
||||
if (mDecoder->GetState() == nsBuiltinDecoder::PLAY_STATE_PLAYING) {
|
||||
@ -1469,7 +1469,7 @@ void nsBuiltinDecoderStateMachine::AdvanceFrame()
|
||||
// Start playing now if need be.
|
||||
if (!IsPlaying()) {
|
||||
StartPlayback();
|
||||
mDecoder->GetMonitor().NotifyAll();
|
||||
mDecoder->GetReentrantMonitor().NotifyAll();
|
||||
}
|
||||
|
||||
if (currentFrame) {
|
||||
@ -1481,7 +1481,7 @@ void nsBuiltinDecoderStateMachine::AdvanceFrame()
|
||||
nsIntSize display = mInfo.mDisplay;
|
||||
float aspect = mInfo.mPixelAspectRatio;
|
||||
{
|
||||
MonitorAutoExit exitMon(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor());
|
||||
// If we have video, we want to increment the clock in steps of the frame
|
||||
// duration.
|
||||
RenderVideoFrame(currentFrame, presTime, display, aspect);
|
||||
@ -1495,7 +1495,7 @@ void nsBuiltinDecoderStateMachine::AdvanceFrame()
|
||||
|
||||
// Kick the decode thread in case it filled its buffers and put itself
|
||||
// to sleep.
|
||||
mDecoder->GetMonitor().NotifyAll();
|
||||
mDecoder->GetReentrantMonitor().NotifyAll();
|
||||
|
||||
// Cap the current time to the larger of the audio and video end time.
|
||||
// This ensures that if we're running off the system clock, we don't
|
||||
@ -1524,18 +1524,18 @@ void nsBuiltinDecoderStateMachine::AdvanceFrame()
|
||||
} else {
|
||||
if (IsPlaying()) {
|
||||
StopPlayback(AUDIO_PAUSE);
|
||||
mDecoder->GetMonitor().NotifyAll();
|
||||
mDecoder->GetReentrantMonitor().NotifyAll();
|
||||
}
|
||||
|
||||
if (mState == DECODER_STATE_DECODING ||
|
||||
mState == DECODER_STATE_COMPLETED) {
|
||||
mDecoder->GetMonitor().Wait();
|
||||
mDecoder->GetReentrantMonitor().Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void nsBuiltinDecoderStateMachine::Wait(PRInt64 aUsecs) {
|
||||
mDecoder->GetMonitor().AssertCurrentThreadIn();
|
||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
TimeStamp end = TimeStamp::Now() + UsecsToDuration(aUsecs);
|
||||
TimeStamp now;
|
||||
while ((now = TimeStamp::Now()) < end &&
|
||||
@ -1546,19 +1546,19 @@ void nsBuiltinDecoderStateMachine::Wait(PRInt64 aUsecs) {
|
||||
if (ms == 0 || ms > PR_UINT32_MAX) {
|
||||
break;
|
||||
}
|
||||
mDecoder->GetMonitor().Wait(PR_MillisecondsToInterval(static_cast<PRUint32>(ms)));
|
||||
mDecoder->GetReentrantMonitor().Wait(PR_MillisecondsToInterval(static_cast<PRUint32>(ms)));
|
||||
}
|
||||
}
|
||||
|
||||
VideoData* nsBuiltinDecoderStateMachine::FindStartTime()
|
||||
{
|
||||
NS_ASSERTION(IsCurrentThread(mDecoder->mStateMachineThread), "Should be on state machine thread.");
|
||||
mDecoder->GetMonitor().AssertCurrentThreadIn();
|
||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
PRInt64 startTime = 0;
|
||||
mStartTime = 0;
|
||||
VideoData* v = nsnull;
|
||||
{
|
||||
MonitorAutoExit exitMon(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor());
|
||||
v = mReader->FindStartTime(0, startTime);
|
||||
}
|
||||
if (startTime != 0) {
|
||||
@ -1583,7 +1583,7 @@ VideoData* nsBuiltinDecoderStateMachine::FindStartTime()
|
||||
void nsBuiltinDecoderStateMachine::FindEndTime()
|
||||
{
|
||||
NS_ASSERTION(OnStateMachineThread(), "Should be on state machine thread.");
|
||||
mDecoder->GetMonitor().AssertCurrentThreadIn();
|
||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
|
||||
nsMediaStream* stream = mDecoder->GetCurrentStream();
|
||||
|
||||
@ -1594,7 +1594,7 @@ void nsBuiltinDecoderStateMachine::FindEndTime()
|
||||
mEndTime = 0;
|
||||
PRInt64 endTime = 0;
|
||||
{
|
||||
MonitorAutoExit exitMon(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor());
|
||||
endTime = mReader->FindEndTime(length);
|
||||
}
|
||||
if (endTime != -1) {
|
||||
@ -1605,7 +1605,7 @@ void nsBuiltinDecoderStateMachine::FindEndTime()
|
||||
}
|
||||
|
||||
void nsBuiltinDecoderStateMachine::UpdateReadyState() {
|
||||
mDecoder->GetMonitor().AssertCurrentThreadIn();
|
||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
|
||||
nsCOMPtr<nsIRunnable> event;
|
||||
switch (GetNextFrameStatus()) {
|
||||
@ -1629,13 +1629,13 @@ void nsBuiltinDecoderStateMachine::LoadMetadata()
|
||||
{
|
||||
NS_ASSERTION(IsCurrentThread(mDecoder->mStateMachineThread),
|
||||
"Should be on state machine thread.");
|
||||
mDecoder->GetMonitor().AssertCurrentThreadIn();
|
||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
|
||||
LOG(PR_LOG_DEBUG, ("Loading Media Headers"));
|
||||
nsresult res;
|
||||
nsVideoInfo info;
|
||||
{
|
||||
MonitorAutoExit exitMon(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor());
|
||||
res = mReader->ReadMetadata(&info);
|
||||
}
|
||||
mInfo = info;
|
||||
@ -1660,7 +1660,7 @@ PRBool nsBuiltinDecoderStateMachine::JustExitedQuickBuffering()
|
||||
|
||||
void nsBuiltinDecoderStateMachine::StartBuffering()
|
||||
{
|
||||
mDecoder->GetMonitor().AssertCurrentThreadIn();
|
||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
|
||||
TimeDuration decodeDuration = TimeStamp::Now() - mDecodeStartTime;
|
||||
// Go into quick buffering mode provided we've not just left buffering using
|
||||
|
@ -118,7 +118,7 @@ not yet time to display the next frame.
|
||||
#include "nsBuiltinDecoderReader.h"
|
||||
#include "nsAudioAvailableEventManager.h"
|
||||
#include "nsHTMLMediaElement.h"
|
||||
#include "mozilla/Monitor.h"
|
||||
#include "mozilla/ReentrantMonitor.h"
|
||||
|
||||
/*
|
||||
The playback state machine class. This manages the decoding in the
|
||||
@ -140,7 +140,7 @@ not yet time to display the next frame.
|
||||
class nsBuiltinDecoderStateMachine : public nsDecoderStateMachine
|
||||
{
|
||||
public:
|
||||
typedef mozilla::Monitor Monitor;
|
||||
typedef mozilla::ReentrantMonitor ReentrantMonitor;
|
||||
typedef mozilla::TimeStamp TimeStamp;
|
||||
typedef mozilla::TimeDuration TimeDuration;
|
||||
|
||||
@ -151,7 +151,7 @@ public:
|
||||
virtual nsresult Init(nsDecoderStateMachine* aCloneDonor);
|
||||
State GetState()
|
||||
{
|
||||
mDecoder->GetMonitor().AssertCurrentThreadIn();
|
||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
return mState;
|
||||
}
|
||||
virtual void SetVolume(double aVolume);
|
||||
@ -183,14 +183,14 @@ public:
|
||||
// This is called on the state machine thread and audio thread.
|
||||
// The decoder monitor must be obtained before calling this.
|
||||
PRBool HasAudio() const {
|
||||
mDecoder->GetMonitor().AssertCurrentThreadIn();
|
||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
return mInfo.mHasAudio;
|
||||
}
|
||||
|
||||
// This is called on the state machine thread and audio thread.
|
||||
// The decoder monitor must be obtained before calling this.
|
||||
PRBool HasVideo() const {
|
||||
mDecoder->GetMonitor().AssertCurrentThreadIn();
|
||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
return mInfo.mHasVideo;
|
||||
}
|
||||
|
||||
@ -199,14 +199,14 @@ public:
|
||||
|
||||
// Must be called with the decode monitor held.
|
||||
PRBool IsBuffering() const {
|
||||
mDecoder->GetMonitor().AssertCurrentThreadIn();
|
||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
|
||||
return mState == nsBuiltinDecoderStateMachine::DECODER_STATE_BUFFERING;
|
||||
}
|
||||
|
||||
// Must be called with the decode monitor held.
|
||||
PRBool IsSeeking() const {
|
||||
mDecoder->GetMonitor().AssertCurrentThreadIn();
|
||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
|
||||
return mState == nsBuiltinDecoderStateMachine::DECODER_STATE_SEEKING;
|
||||
}
|
||||
@ -243,7 +243,7 @@ public:
|
||||
}
|
||||
|
||||
PRInt64 GetEndMediaTime() const {
|
||||
mDecoder->GetMonitor().AssertCurrentThreadIn();
|
||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
return mEndTime;
|
||||
}
|
||||
|
||||
@ -278,7 +278,7 @@ protected:
|
||||
// Returns PR_TRUE if we recently exited "quick buffering" mode.
|
||||
PRBool JustExitedQuickBuffering();
|
||||
|
||||
// Waits on the decoder Monitor for aUsecs microseconds. If the decoder
|
||||
// Waits on the decoder ReentrantMonitor for aUsecs microseconds. If the decoder
|
||||
// monitor is awoken by a Notify() call, we'll continue waiting, unless
|
||||
// we've moved into shutdown state. This enables us to ensure that we
|
||||
// wait for a specified time, and that the myriad of Notify()s we do an
|
||||
@ -389,7 +389,7 @@ protected:
|
||||
// not start at 0. Note this is different to the value returned
|
||||
// by GetCurrentTime(), which is in the range [0,duration].
|
||||
PRInt64 GetMediaTime() const {
|
||||
mDecoder->GetMonitor().AssertCurrentThreadIn();
|
||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
return mStartTime + mCurrentFrameTime;
|
||||
}
|
||||
|
||||
@ -402,11 +402,11 @@ protected:
|
||||
// must be held when calling this. Called on the decoder thread.
|
||||
PRInt64 GetDecodedAudioDuration();
|
||||
|
||||
// Monitor on mAudioStream. This monitor must be held in order to delete
|
||||
// or use the audio stream. This stops us destroying the audio stream
|
||||
// while it's being used on another thread (typically when it's being
|
||||
// written to on the audio thread).
|
||||
Monitor mAudioMonitor;
|
||||
// ReentrantMonitor on mAudioStream. This monitor must be held in
|
||||
// order to delete or use the audio stream. This stops us destroying
|
||||
// the audio stream while it's being used on another thread
|
||||
// (typically when it's being written to on the audio thread).
|
||||
ReentrantMonitor mAudioReentrantMonitor;
|
||||
|
||||
// The size of the decoded YCbCr frame.
|
||||
// Accessed on state machine thread.
|
||||
@ -454,9 +454,9 @@ protected:
|
||||
// this value. Accessed on main and state machine thread.
|
||||
PRInt64 mSeekTime;
|
||||
|
||||
// The audio stream resource. Used on the state machine, audio, and main
|
||||
// threads. You must hold the mAudioMonitor, and must NOT hold the decoder
|
||||
// monitor when using the audio stream!
|
||||
// The audio stream resource. Used on the state machine, audio, and
|
||||
// main threads. You must hold the mAudioReentrantMonitor, and must
|
||||
// NOT hold the decoder monitor when using the audio stream!
|
||||
nsRefPtr<nsAudioStream> mAudioStream;
|
||||
|
||||
// The reader, don't call its methods with the decoder monitor held.
|
||||
|
@ -36,7 +36,7 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "mozilla/Monitor.h"
|
||||
#include "mozilla/ReentrantMonitor.h"
|
||||
#include "mozilla/XPCOM.h"
|
||||
|
||||
#include "nsMediaCache.h"
|
||||
@ -134,7 +134,7 @@ public:
|
||||
};
|
||||
|
||||
nsMediaCache() : mNextResourceID(1),
|
||||
mMonitor("nsMediaCache.mMonitor"),
|
||||
mReentrantMonitor("nsMediaCache.mReentrantMonitor"),
|
||||
mFD(nsnull), mFDCurrentPos(0), mUpdateQueued(PR_FALSE)
|
||||
#ifdef DEBUG
|
||||
, mInUpdate(PR_FALSE)
|
||||
@ -168,7 +168,7 @@ public:
|
||||
void FlushInternal();
|
||||
|
||||
// Cache-file access methods. These are the lowest-level cache methods.
|
||||
// mMonitor must be held; these can be called on any thread.
|
||||
// mReentrantMonitor must be held; these can be called on any thread.
|
||||
// This can return partial reads.
|
||||
nsresult ReadCacheFile(PRInt64 aOffset, void* aData, PRInt32 aLength,
|
||||
PRInt32* aBytes);
|
||||
@ -177,7 +177,7 @@ public:
|
||||
// This will fail if all aLength bytes are not written
|
||||
nsresult WriteCacheFile(PRInt64 aOffset, const void* aData, PRInt32 aLength);
|
||||
|
||||
// mMonitor must be held, called on main thread.
|
||||
// mReentrantMonitor must be held, called on main thread.
|
||||
// These methods are used by the stream to set up and tear down streams,
|
||||
// and to handle reads and writes.
|
||||
// Add aStream to the list of streams.
|
||||
@ -190,7 +190,7 @@ public:
|
||||
void AllocateAndWriteBlock(nsMediaCacheStream* aStream, const void* aData,
|
||||
nsMediaCacheStream::ReadMode aMode);
|
||||
|
||||
// mMonitor must be held; can be called on any thread
|
||||
// mReentrantMonitor must be held; can be called on any thread
|
||||
// Notify the cache that a seek has been requested. Some blocks may
|
||||
// need to change their class between PLAYED_BLOCK and READAHEAD_BLOCK.
|
||||
// This does not trigger channel seeks directly, the next Update()
|
||||
@ -227,7 +227,7 @@ public:
|
||||
void Verify() {}
|
||||
#endif
|
||||
|
||||
Monitor& GetMonitor() { return mMonitor; }
|
||||
ReentrantMonitor& GetReentrantMonitor() { return mReentrantMonitor; }
|
||||
|
||||
/**
|
||||
* An iterator that makes it easy to iterate through all streams that
|
||||
@ -350,7 +350,7 @@ protected:
|
||||
// The monitor protects all the data members here. Also, off-main-thread
|
||||
// readers that need to block will Wait() on this monitor. When new
|
||||
// data becomes available in the cache, we NotifyAll() on this monitor.
|
||||
Monitor mMonitor;
|
||||
ReentrantMonitor mReentrantMonitor;
|
||||
// The Blocks describing the cache entries.
|
||||
nsTArray<Block> mIndex;
|
||||
// The file descriptor of the cache file. The file will be deleted
|
||||
@ -608,7 +608,7 @@ nsMediaCache::Flush()
|
||||
void
|
||||
nsMediaCache::FlushInternal()
|
||||
{
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
|
||||
for (PRUint32 blockIndex = 0; blockIndex < mIndex.Length(); ++blockIndex) {
|
||||
FreeBlock(blockIndex);
|
||||
@ -663,7 +663,7 @@ nsresult
|
||||
nsMediaCache::ReadCacheFile(PRInt64 aOffset, void* aData, PRInt32 aLength,
|
||||
PRInt32* aBytes)
|
||||
{
|
||||
mMonitor.AssertCurrentThreadIn();
|
||||
mReentrantMonitor.AssertCurrentThreadIn();
|
||||
|
||||
if (!mFD)
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -685,7 +685,7 @@ nsMediaCache::ReadCacheFile(PRInt64 aOffset, void* aData, PRInt32 aLength,
|
||||
nsresult
|
||||
nsMediaCache::ReadCacheFileAllBytes(PRInt64 aOffset, void* aData, PRInt32 aLength)
|
||||
{
|
||||
mMonitor.AssertCurrentThreadIn();
|
||||
mReentrantMonitor.AssertCurrentThreadIn();
|
||||
|
||||
PRInt64 offset = aOffset;
|
||||
PRInt32 count = aLength;
|
||||
@ -708,7 +708,7 @@ nsMediaCache::ReadCacheFileAllBytes(PRInt64 aOffset, void* aData, PRInt32 aLengt
|
||||
nsresult
|
||||
nsMediaCache::WriteCacheFile(PRInt64 aOffset, const void* aData, PRInt32 aLength)
|
||||
{
|
||||
mMonitor.AssertCurrentThreadIn();
|
||||
mReentrantMonitor.AssertCurrentThreadIn();
|
||||
|
||||
if (!mFD)
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -749,7 +749,7 @@ PRInt32
|
||||
nsMediaCache::FindBlockForIncomingData(TimeStamp aNow,
|
||||
nsMediaCacheStream* aStream)
|
||||
{
|
||||
mMonitor.AssertCurrentThreadIn();
|
||||
mReentrantMonitor.AssertCurrentThreadIn();
|
||||
|
||||
PRInt32 blockIndex = FindReusableBlock(aNow, aStream,
|
||||
aStream->mChannelOffset/BLOCK_SIZE, PR_INT32_MAX);
|
||||
@ -792,7 +792,7 @@ nsMediaCache::AppendMostReusableBlock(BlockList* aBlockList,
|
||||
nsTArray<PRUint32>* aResult,
|
||||
PRInt32 aBlockIndexLimit)
|
||||
{
|
||||
mMonitor.AssertCurrentThreadIn();
|
||||
mReentrantMonitor.AssertCurrentThreadIn();
|
||||
|
||||
PRInt32 blockIndex = aBlockList->GetLastBlock();
|
||||
if (blockIndex < 0)
|
||||
@ -816,7 +816,7 @@ nsMediaCache::FindReusableBlock(TimeStamp aNow,
|
||||
PRInt32 aForStreamBlock,
|
||||
PRInt32 aMaxSearchBlockIndex)
|
||||
{
|
||||
mMonitor.AssertCurrentThreadIn();
|
||||
mReentrantMonitor.AssertCurrentThreadIn();
|
||||
|
||||
PRUint32 length = PR_MIN(PRUint32(aMaxSearchBlockIndex), mIndex.Length());
|
||||
|
||||
@ -910,7 +910,7 @@ nsMediaCache::GetBlockOwner(PRInt32 aBlockIndex, nsMediaCacheStream* aStream)
|
||||
void
|
||||
nsMediaCache::SwapBlocks(PRInt32 aBlockIndex1, PRInt32 aBlockIndex2)
|
||||
{
|
||||
mMonitor.AssertCurrentThreadIn();
|
||||
mReentrantMonitor.AssertCurrentThreadIn();
|
||||
|
||||
Block* block1 = &mIndex[aBlockIndex1];
|
||||
Block* block2 = &mIndex[aBlockIndex2];
|
||||
@ -990,7 +990,7 @@ nsMediaCache::AddBlockOwnerAsReadahead(PRInt32 aBlockIndex,
|
||||
void
|
||||
nsMediaCache::FreeBlock(PRInt32 aBlock)
|
||||
{
|
||||
mMonitor.AssertCurrentThreadIn();
|
||||
mReentrantMonitor.AssertCurrentThreadIn();
|
||||
|
||||
Block* block = &mIndex[aBlock];
|
||||
if (block->mOwners.IsEmpty()) {
|
||||
@ -1013,7 +1013,7 @@ nsMediaCache::FreeBlock(PRInt32 aBlock)
|
||||
TimeDuration
|
||||
nsMediaCache::PredictNextUse(TimeStamp aNow, PRInt32 aBlock)
|
||||
{
|
||||
mMonitor.AssertCurrentThreadIn();
|
||||
mReentrantMonitor.AssertCurrentThreadIn();
|
||||
NS_ASSERTION(!IsBlockFree(aBlock), "aBlock is free");
|
||||
|
||||
Block* block = &mIndex[aBlock];
|
||||
@ -1063,7 +1063,7 @@ nsMediaCache::PredictNextUse(TimeStamp aNow, PRInt32 aBlock)
|
||||
TimeDuration
|
||||
nsMediaCache::PredictNextUseForIncomingData(nsMediaCacheStream* aStream)
|
||||
{
|
||||
mMonitor.AssertCurrentThreadIn();
|
||||
mReentrantMonitor.AssertCurrentThreadIn();
|
||||
|
||||
PRInt64 bytesAhead = aStream->mChannelOffset - aStream->mStreamOffset;
|
||||
if (bytesAhead <= -BLOCK_SIZE) {
|
||||
@ -1091,7 +1091,7 @@ nsMediaCache::Update()
|
||||
nsAutoTArray<StreamAction,10> actions;
|
||||
|
||||
{
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
mUpdateQueued = PR_FALSE;
|
||||
#ifdef DEBUG
|
||||
mInUpdate = PR_TRUE;
|
||||
@ -1373,7 +1373,7 @@ nsMediaCache::Update()
|
||||
// Close the streams that failed due to error. This will cause all
|
||||
// client Read and Seek operations on those streams to fail. Blocked
|
||||
// Reads will also be woken up.
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
stream->CloseInternal(mon);
|
||||
}
|
||||
}
|
||||
@ -1394,7 +1394,7 @@ public:
|
||||
void
|
||||
nsMediaCache::QueueUpdate()
|
||||
{
|
||||
mMonitor.AssertCurrentThreadIn();
|
||||
mReentrantMonitor.AssertCurrentThreadIn();
|
||||
|
||||
// Queuing an update while we're in an update raises a high risk of
|
||||
// triggering endless events
|
||||
@ -1411,7 +1411,7 @@ nsMediaCache::QueueUpdate()
|
||||
void
|
||||
nsMediaCache::Verify()
|
||||
{
|
||||
mMonitor.AssertCurrentThreadIn();
|
||||
mReentrantMonitor.AssertCurrentThreadIn();
|
||||
|
||||
mFreeBlocks.Verify();
|
||||
for (PRUint32 i = 0; i < mStreams.Length(); ++i) {
|
||||
@ -1443,7 +1443,7 @@ void
|
||||
nsMediaCache::InsertReadaheadBlock(BlockOwner* aBlockOwner,
|
||||
PRInt32 aBlockIndex)
|
||||
{
|
||||
mMonitor.AssertCurrentThreadIn();
|
||||
mReentrantMonitor.AssertCurrentThreadIn();
|
||||
|
||||
// Find the last block whose stream block is before aBlockIndex's
|
||||
// stream block, and insert after it
|
||||
@ -1469,7 +1469,7 @@ void
|
||||
nsMediaCache::AllocateAndWriteBlock(nsMediaCacheStream* aStream, const void* aData,
|
||||
nsMediaCacheStream::ReadMode aMode)
|
||||
{
|
||||
mMonitor.AssertCurrentThreadIn();
|
||||
mReentrantMonitor.AssertCurrentThreadIn();
|
||||
|
||||
PRInt32 streamBlockIndex = aStream->mChannelOffset/BLOCK_SIZE;
|
||||
|
||||
@ -1547,7 +1547,7 @@ nsMediaCache::OpenStream(nsMediaCacheStream* aStream)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
|
||||
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
LOG(PR_LOG_DEBUG, ("Stream %p opened", aStream));
|
||||
mStreams.AppendElement(aStream);
|
||||
aStream->mResourceID = mNextResourceID++;
|
||||
@ -1561,7 +1561,7 @@ nsMediaCache::ReleaseStream(nsMediaCacheStream* aStream)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
|
||||
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
LOG(PR_LOG_DEBUG, ("Stream %p closed", aStream));
|
||||
mStreams.RemoveElement(aStream);
|
||||
}
|
||||
@ -1569,7 +1569,7 @@ nsMediaCache::ReleaseStream(nsMediaCacheStream* aStream)
|
||||
void
|
||||
nsMediaCache::ReleaseStreamBlocks(nsMediaCacheStream* aStream)
|
||||
{
|
||||
mMonitor.AssertCurrentThreadIn();
|
||||
mReentrantMonitor.AssertCurrentThreadIn();
|
||||
|
||||
// XXX scanning the entire stream doesn't seem great, if not much of it
|
||||
// is cached, but the only easy alternative is to scan the entire cache
|
||||
@ -1609,7 +1609,7 @@ nsMediaCache::NoteBlockUsage(nsMediaCacheStream* aStream, PRInt32 aBlockIndex,
|
||||
nsMediaCacheStream::ReadMode aMode,
|
||||
TimeStamp aNow)
|
||||
{
|
||||
mMonitor.AssertCurrentThreadIn();
|
||||
mReentrantMonitor.AssertCurrentThreadIn();
|
||||
|
||||
if (aBlockIndex < 0) {
|
||||
// this block is not in the cache yet
|
||||
@ -1641,7 +1641,7 @@ nsMediaCache::NoteBlockUsage(nsMediaCacheStream* aStream, PRInt32 aBlockIndex,
|
||||
void
|
||||
nsMediaCache::NoteSeek(nsMediaCacheStream* aStream, PRInt64 aOldOffset)
|
||||
{
|
||||
mMonitor.AssertCurrentThreadIn();
|
||||
mReentrantMonitor.AssertCurrentThreadIn();
|
||||
|
||||
if (aOldOffset < aStream->mStreamOffset) {
|
||||
// We seeked forward. Convert blocks from readahead to played.
|
||||
@ -1697,7 +1697,7 @@ nsMediaCacheStream::NotifyDataLength(PRInt64 aLength)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
|
||||
|
||||
MonitorAutoEnter mon(gMediaCache->GetMonitor());
|
||||
ReentrantMonitorAutoEnter mon(gMediaCache->GetReentrantMonitor());
|
||||
mStreamLength = aLength;
|
||||
}
|
||||
|
||||
@ -1706,7 +1706,7 @@ nsMediaCacheStream::NotifyDataStarted(PRInt64 aOffset)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
|
||||
|
||||
MonitorAutoEnter mon(gMediaCache->GetMonitor());
|
||||
ReentrantMonitorAutoEnter mon(gMediaCache->GetReentrantMonitor());
|
||||
NS_WARN_IF_FALSE(aOffset == mChannelOffset,
|
||||
"Server is giving us unexpected offset");
|
||||
mChannelOffset = aOffset;
|
||||
@ -1757,7 +1757,7 @@ nsMediaCacheStream::NotifyDataReceived(PRInt64 aSize, const char* aData,
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
|
||||
|
||||
MonitorAutoEnter mon(gMediaCache->GetMonitor());
|
||||
ReentrantMonitorAutoEnter mon(gMediaCache->GetReentrantMonitor());
|
||||
PRInt64 size = aSize;
|
||||
const char* data = aData;
|
||||
|
||||
@ -1826,7 +1826,7 @@ nsMediaCacheStream::NotifyDataEnded(nsresult aStatus)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
|
||||
|
||||
MonitorAutoEnter mon(gMediaCache->GetMonitor());
|
||||
ReentrantMonitorAutoEnter mon(gMediaCache->GetReentrantMonitor());
|
||||
|
||||
PRInt32 blockOffset = PRInt32(mChannelOffset%BLOCK_SIZE);
|
||||
if (blockOffset > 0) {
|
||||
@ -1864,7 +1864,7 @@ nsMediaCacheStream::~nsMediaCacheStream()
|
||||
void
|
||||
nsMediaCacheStream::SetSeekable(PRBool aIsSeekable)
|
||||
{
|
||||
MonitorAutoEnter mon(gMediaCache->GetMonitor());
|
||||
ReentrantMonitorAutoEnter mon(gMediaCache->GetReentrantMonitor());
|
||||
NS_ASSERTION(mIsSeekable || aIsSeekable ||
|
||||
mChannelOffset == 0, "channel offset must be zero when we become non-seekable");
|
||||
mIsSeekable = aIsSeekable;
|
||||
@ -1876,7 +1876,7 @@ nsMediaCacheStream::SetSeekable(PRBool aIsSeekable)
|
||||
PRBool
|
||||
nsMediaCacheStream::IsSeekable()
|
||||
{
|
||||
MonitorAutoEnter mon(gMediaCache->GetMonitor());
|
||||
ReentrantMonitorAutoEnter mon(gMediaCache->GetReentrantMonitor());
|
||||
return mIsSeekable;
|
||||
}
|
||||
|
||||
@ -1885,7 +1885,7 @@ nsMediaCacheStream::Close()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
|
||||
|
||||
MonitorAutoEnter mon(gMediaCache->GetMonitor());
|
||||
ReentrantMonitorAutoEnter mon(gMediaCache->GetReentrantMonitor());
|
||||
CloseInternal(mon);
|
||||
// Queue an Update since we may have created more free space. Don't do
|
||||
// it from CloseInternal since that gets called by Update() itself
|
||||
@ -1894,7 +1894,7 @@ nsMediaCacheStream::Close()
|
||||
}
|
||||
|
||||
void
|
||||
nsMediaCacheStream::CloseInternal(MonitorAutoEnter& aMonitor)
|
||||
nsMediaCacheStream::CloseInternal(ReentrantMonitorAutoEnter& aReentrantMonitor)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
|
||||
|
||||
@ -1903,13 +1903,13 @@ nsMediaCacheStream::CloseInternal(MonitorAutoEnter& aMonitor)
|
||||
mClosed = PR_TRUE;
|
||||
gMediaCache->ReleaseStreamBlocks(this);
|
||||
// Wake up any blocked readers
|
||||
aMonitor.NotifyAll();
|
||||
aReentrantMonitor.NotifyAll();
|
||||
}
|
||||
|
||||
void
|
||||
nsMediaCacheStream::Pin()
|
||||
{
|
||||
MonitorAutoEnter mon(gMediaCache->GetMonitor());
|
||||
ReentrantMonitorAutoEnter mon(gMediaCache->GetReentrantMonitor());
|
||||
++mPinCount;
|
||||
// Queue an Update since we may no longer want to read more into the
|
||||
// cache, if this stream's block have become non-evictable
|
||||
@ -1919,7 +1919,7 @@ nsMediaCacheStream::Pin()
|
||||
void
|
||||
nsMediaCacheStream::Unpin()
|
||||
{
|
||||
MonitorAutoEnter mon(gMediaCache->GetMonitor());
|
||||
ReentrantMonitorAutoEnter mon(gMediaCache->GetReentrantMonitor());
|
||||
NS_ASSERTION(mPinCount > 0, "Unbalanced Unpin");
|
||||
--mPinCount;
|
||||
// Queue an Update since we may be able to read more into the
|
||||
@ -1930,28 +1930,28 @@ nsMediaCacheStream::Unpin()
|
||||
PRInt64
|
||||
nsMediaCacheStream::GetLength()
|
||||
{
|
||||
MonitorAutoEnter mon(gMediaCache->GetMonitor());
|
||||
ReentrantMonitorAutoEnter mon(gMediaCache->GetReentrantMonitor());
|
||||
return mStreamLength;
|
||||
}
|
||||
|
||||
PRInt64
|
||||
nsMediaCacheStream::GetNextCachedData(PRInt64 aOffset)
|
||||
{
|
||||
MonitorAutoEnter mon(gMediaCache->GetMonitor());
|
||||
ReentrantMonitorAutoEnter mon(gMediaCache->GetReentrantMonitor());
|
||||
return GetNextCachedDataInternal(aOffset);
|
||||
}
|
||||
|
||||
PRInt64
|
||||
nsMediaCacheStream::GetCachedDataEnd(PRInt64 aOffset)
|
||||
{
|
||||
MonitorAutoEnter mon(gMediaCache->GetMonitor());
|
||||
ReentrantMonitorAutoEnter mon(gMediaCache->GetReentrantMonitor());
|
||||
return GetCachedDataEndInternal(aOffset);
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsMediaCacheStream::IsDataCachedToEndOfStream(PRInt64 aOffset)
|
||||
{
|
||||
MonitorAutoEnter mon(gMediaCache->GetMonitor());
|
||||
ReentrantMonitorAutoEnter mon(gMediaCache->GetReentrantMonitor());
|
||||
if (mStreamLength < 0)
|
||||
return PR_FALSE;
|
||||
return GetCachedDataEndInternal(aOffset) >= mStreamLength;
|
||||
@ -1960,7 +1960,7 @@ nsMediaCacheStream::IsDataCachedToEndOfStream(PRInt64 aOffset)
|
||||
PRInt64
|
||||
nsMediaCacheStream::GetCachedDataEndInternal(PRInt64 aOffset)
|
||||
{
|
||||
gMediaCache->GetMonitor().AssertCurrentThreadIn();
|
||||
gMediaCache->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
PRUint32 startBlockIndex = aOffset/BLOCK_SIZE;
|
||||
PRUint32 blockIndex = startBlockIndex;
|
||||
while (blockIndex < mBlocks.Length() && mBlocks[blockIndex] != -1) {
|
||||
@ -1983,7 +1983,7 @@ nsMediaCacheStream::GetCachedDataEndInternal(PRInt64 aOffset)
|
||||
PRInt64
|
||||
nsMediaCacheStream::GetNextCachedDataInternal(PRInt64 aOffset)
|
||||
{
|
||||
gMediaCache->GetMonitor().AssertCurrentThreadIn();
|
||||
gMediaCache->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
if (aOffset == mStreamLength)
|
||||
return -1;
|
||||
|
||||
@ -2030,7 +2030,7 @@ nsMediaCacheStream::GetNextCachedDataInternal(PRInt64 aOffset)
|
||||
void
|
||||
nsMediaCacheStream::SetReadMode(ReadMode aMode)
|
||||
{
|
||||
MonitorAutoEnter mon(gMediaCache->GetMonitor());
|
||||
ReentrantMonitorAutoEnter mon(gMediaCache->GetReentrantMonitor());
|
||||
if (aMode == mCurrentMode)
|
||||
return;
|
||||
mCurrentMode = aMode;
|
||||
@ -2041,7 +2041,7 @@ void
|
||||
nsMediaCacheStream::SetPlaybackRate(PRUint32 aBytesPerSecond)
|
||||
{
|
||||
NS_ASSERTION(aBytesPerSecond > 0, "Zero playback rate not allowed");
|
||||
MonitorAutoEnter mon(gMediaCache->GetMonitor());
|
||||
ReentrantMonitorAutoEnter mon(gMediaCache->GetReentrantMonitor());
|
||||
if (aBytesPerSecond == mPlaybackBytesPerSecond)
|
||||
return;
|
||||
mPlaybackBytesPerSecond = aBytesPerSecond;
|
||||
@ -2053,7 +2053,7 @@ nsMediaCacheStream::Seek(PRInt32 aWhence, PRInt64 aOffset)
|
||||
{
|
||||
NS_ASSERTION(!NS_IsMainThread(), "Don't call on main thread");
|
||||
|
||||
MonitorAutoEnter mon(gMediaCache->GetMonitor());
|
||||
ReentrantMonitorAutoEnter mon(gMediaCache->GetReentrantMonitor());
|
||||
if (mClosed)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
@ -2087,7 +2087,7 @@ nsMediaCacheStream::Tell()
|
||||
{
|
||||
NS_ASSERTION(!NS_IsMainThread(), "Don't call on main thread");
|
||||
|
||||
MonitorAutoEnter mon(gMediaCache->GetMonitor());
|
||||
ReentrantMonitorAutoEnter mon(gMediaCache->GetReentrantMonitor());
|
||||
return mStreamOffset;
|
||||
}
|
||||
|
||||
@ -2096,7 +2096,7 @@ nsMediaCacheStream::Read(char* aBuffer, PRUint32 aCount, PRUint32* aBytes)
|
||||
{
|
||||
NS_ASSERTION(!NS_IsMainThread(), "Don't call on main thread");
|
||||
|
||||
MonitorAutoEnter mon(gMediaCache->GetMonitor());
|
||||
ReentrantMonitorAutoEnter mon(gMediaCache->GetReentrantMonitor());
|
||||
if (mClosed)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
@ -2181,7 +2181,7 @@ nsMediaCacheStream::ReadFromCache(char* aBuffer,
|
||||
PRInt64 aOffset,
|
||||
PRInt64 aCount)
|
||||
{
|
||||
MonitorAutoEnter mon(gMediaCache->GetMonitor());
|
||||
ReentrantMonitorAutoEnter mon(gMediaCache->GetReentrantMonitor());
|
||||
if (mClosed)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
@ -2259,7 +2259,7 @@ nsMediaCacheStream::InitAsClone(nsMediaCacheStream* aOriginal)
|
||||
mResourceID = aOriginal->mResourceID;
|
||||
|
||||
// Grab cache blocks from aOriginal as readahead blocks for our stream
|
||||
MonitorAutoEnter mon(gMediaCache->GetMonitor());
|
||||
ReentrantMonitorAutoEnter mon(gMediaCache->GetReentrantMonitor());
|
||||
|
||||
mPrincipal = aOriginal->mPrincipal;
|
||||
mStreamLength = aOriginal->mStreamLength;
|
||||
@ -2289,7 +2289,7 @@ nsresult nsMediaCacheStream::GetCachedRanges(nsTArray<nsByteRange>& aRanges)
|
||||
{
|
||||
// Take the monitor, so that the cached data ranges can't grow while we're
|
||||
// trying to loop over them.
|
||||
MonitorAutoEnter mon(gMediaCache->GetMonitor());
|
||||
ReentrantMonitorAutoEnter mon(gMediaCache->GetReentrantMonitor());
|
||||
|
||||
// We must be pinned while running this, otherwise the cached data ranges may
|
||||
// shrink while we're trying to loop over them.
|
||||
|
@ -45,7 +45,7 @@
|
||||
|
||||
class nsByteRange;
|
||||
namespace mozilla {
|
||||
class MonitorAutoEnter;
|
||||
class ReentrantMonitorAutoEnter;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -211,7 +211,7 @@ class nsMediaChannelStream;
|
||||
* This class can be directly embedded as a value.
|
||||
*/
|
||||
class nsMediaCacheStream {
|
||||
typedef mozilla::MonitorAutoEnter MonitorAutoEnter;
|
||||
typedef mozilla::ReentrantMonitorAutoEnter ReentrantMonitorAutoEnter;
|
||||
|
||||
public:
|
||||
enum {
|
||||
@ -430,10 +430,10 @@ private:
|
||||
PRInt64 GetNextCachedDataInternal(PRInt64 aOffset);
|
||||
// A helper function to do the work of closing the stream. Assumes
|
||||
// that the cache monitor is held. Main thread only.
|
||||
// aMonitor is the nsAutoMonitor wrapper holding the cache monitor.
|
||||
// aReentrantMonitor is the nsAutoReentrantMonitor wrapper holding the cache monitor.
|
||||
// This is used to NotifyAll to wake up threads that might be
|
||||
// blocked on reading from this stream.
|
||||
void CloseInternal(MonitorAutoEnter& aMonitor);
|
||||
void CloseInternal(ReentrantMonitorAutoEnter& aReentrantMonitor);
|
||||
// Update mPrincipal given that data has been received from aPrincipal
|
||||
void UpdatePrincipal(nsIPrincipal* aPrincipal);
|
||||
|
||||
|
@ -47,7 +47,7 @@
|
||||
#include "gfxRect.h"
|
||||
#include "nsITimer.h"
|
||||
#include "ImageLayers.h"
|
||||
#include "mozilla/Monitor.h"
|
||||
#include "mozilla/ReentrantMonitor.h"
|
||||
#include "mozilla/Mutex.h"
|
||||
|
||||
class nsHTMLMediaElement;
|
||||
@ -89,7 +89,7 @@ public:
|
||||
typedef mozilla::TimeDuration TimeDuration;
|
||||
typedef mozilla::layers::ImageContainer ImageContainer;
|
||||
typedef mozilla::layers::Image Image;
|
||||
typedef mozilla::Monitor Monitor;
|
||||
typedef mozilla::ReentrantMonitor ReentrantMonitor;
|
||||
typedef mozilla::Mutex Mutex;
|
||||
|
||||
nsMediaDecoder();
|
||||
@ -190,7 +190,7 @@ public:
|
||||
public:
|
||||
|
||||
FrameStatistics() :
|
||||
mMonitor("nsMediaDecoder::FrameStats"),
|
||||
mReentrantMonitor("nsMediaDecoder::FrameStats"),
|
||||
mParsedFrames(0),
|
||||
mDecodedFrames(0),
|
||||
mPresentedFrames(0) {}
|
||||
@ -198,14 +198,14 @@ public:
|
||||
// Returns number of frames which have been parsed from the media.
|
||||
// Can be called on any thread.
|
||||
PRUint32 GetParsedFrames() {
|
||||
mozilla::MonitorAutoEnter mon(mMonitor);
|
||||
mozilla::ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
return mParsedFrames;
|
||||
}
|
||||
|
||||
// Returns the number of parsed frames which have been decoded.
|
||||
// Can be called on any thread.
|
||||
PRUint32 GetDecodedFrames() {
|
||||
mozilla::MonitorAutoEnter mon(mMonitor);
|
||||
mozilla::ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
return mDecodedFrames;
|
||||
}
|
||||
|
||||
@ -213,7 +213,7 @@ public:
|
||||
// pipeline for painting ("presented").
|
||||
// Can be called on any thread.
|
||||
PRUint32 GetPresentedFrames() {
|
||||
mozilla::MonitorAutoEnter mon(mMonitor);
|
||||
mozilla::ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
return mPresentedFrames;
|
||||
}
|
||||
|
||||
@ -222,7 +222,7 @@ public:
|
||||
void NotifyDecodedFrames(PRUint32 aParsed, PRUint32 aDecoded) {
|
||||
if (aParsed == 0 && aDecoded == 0)
|
||||
return;
|
||||
mozilla::MonitorAutoEnter mon(mMonitor);
|
||||
mozilla::ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
mParsedFrames += aParsed;
|
||||
mDecodedFrames += aDecoded;
|
||||
}
|
||||
@ -230,25 +230,25 @@ public:
|
||||
// Increments the presented frame counters.
|
||||
// Can be called on any thread.
|
||||
void NotifyPresentedFrame() {
|
||||
mozilla::MonitorAutoEnter mon(mMonitor);
|
||||
mozilla::ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
++mPresentedFrames;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
// Monitor to protect access of playback statistics.
|
||||
Monitor mMonitor;
|
||||
// ReentrantMonitor to protect access of playback statistics.
|
||||
ReentrantMonitor mReentrantMonitor;
|
||||
|
||||
// Number of frames parsed and demuxed from media.
|
||||
// Access protected by mStatsMonitor.
|
||||
// Access protected by mStatsReentrantMonitor.
|
||||
PRUint32 mParsedFrames;
|
||||
|
||||
// Number of parsed frames which were actually decoded.
|
||||
// Access protected by mStatsMonitor.
|
||||
// Access protected by mStatsReentrantMonitor.
|
||||
PRUint32 mDecodedFrames;
|
||||
|
||||
// Number of decoded frames which were actually sent down the rendering
|
||||
// pipeline to be painted ("presented"). Access protected by mStatsMonitor.
|
||||
// pipeline to be painted ("presented"). Access protected by mStatsReentrantMonitor.
|
||||
PRUint32 mPresentedFrames;
|
||||
};
|
||||
|
||||
|
@ -144,7 +144,7 @@ nsresult nsOggReader::ResetDecode()
|
||||
}
|
||||
|
||||
{
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
|
||||
// Discard any previously buffered packets/pages.
|
||||
ogg_sync_reset(&mOggState);
|
||||
@ -173,7 +173,7 @@ static PRBool DoneReadingHeaders(nsTArray<nsOggCodecState*>& aBitstreams) {
|
||||
nsresult nsOggReader::ReadMetadata(nsVideoInfo* aInfo)
|
||||
{
|
||||
NS_ASSERTION(mDecoder->OnStateMachineThread(), "Should be on play state machine thread.");
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
|
||||
// We read packets until all bitstreams have read all their header packets.
|
||||
// We record the offset of the first non-header page so that we know
|
||||
@ -338,8 +338,8 @@ nsresult nsOggReader::ReadMetadata(nsVideoInfo* aInfo)
|
||||
}
|
||||
PRInt64 duration = 0;
|
||||
if (NS_SUCCEEDED(mSkeletonState->GetDuration(tracks, duration))) {
|
||||
MonitorAutoExit exitReaderMon(mMonitor);
|
||||
MonitorAutoEnter decoderMon(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoExit exitReaderMon(mReentrantMonitor);
|
||||
ReentrantMonitorAutoEnter decoderMon(mDecoder->GetReentrantMonitor());
|
||||
mDecoder->GetStateMachine()->SetDuration(duration);
|
||||
LOG(PR_LOG_DEBUG, ("Got duration from Skeleton index %lld", duration));
|
||||
}
|
||||
@ -412,7 +412,7 @@ nsresult nsOggReader::DecodeVorbis(nsTArray<nsAutoPtr<SoundData> >& aChunks,
|
||||
|
||||
PRBool nsOggReader::DecodeAudioData()
|
||||
{
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
NS_ASSERTION(mDecoder->OnStateMachineThread() || mDecoder->OnDecodeThread(),
|
||||
"Should be on playback or decode thread.");
|
||||
NS_ASSERTION(mVorbisState!=0, "Need Vorbis state to decode audio");
|
||||
@ -568,7 +568,7 @@ nsresult nsOggReader::DecodeTheora(nsTArray<nsAutoPtr<VideoData> >& aFrames,
|
||||
|
||||
// Need the monitor to be held to be able to use mInfo. This
|
||||
// is held by our caller.
|
||||
mMonitor.AssertCurrentThreadIn();
|
||||
mReentrantMonitor.AssertCurrentThreadIn();
|
||||
VideoData *v = VideoData::Create(mInfo,
|
||||
mDecoder->GetImageContainer(),
|
||||
mPageOffset,
|
||||
@ -593,7 +593,7 @@ nsresult nsOggReader::DecodeTheora(nsTArray<nsAutoPtr<VideoData> >& aFrames,
|
||||
PRBool nsOggReader::DecodeVideoFrame(PRBool &aKeyframeSkip,
|
||||
PRInt64 aTimeThreshold)
|
||||
{
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
NS_ASSERTION(mDecoder->OnStateMachineThread() || mDecoder->OnDecodeThread(),
|
||||
"Should be on state machine or AV thread.");
|
||||
|
||||
@ -801,7 +801,7 @@ PRInt64 nsOggReader::ReadOggPage(ogg_page* aPage)
|
||||
{
|
||||
NS_ASSERTION(mDecoder->OnStateMachineThread() || mDecoder->OnDecodeThread(),
|
||||
"Should be on play state machine or decode thread.");
|
||||
mMonitor.AssertCurrentThreadIn();
|
||||
mReentrantMonitor.AssertCurrentThreadIn();
|
||||
|
||||
int ret = 0;
|
||||
while((ret = ogg_sync_pageseek(&mOggState, aPage)) <= 0) {
|
||||
@ -842,7 +842,7 @@ PRBool nsOggReader::ReadOggPacket(nsOggCodecState* aCodecState,
|
||||
{
|
||||
NS_ASSERTION(mDecoder->OnStateMachineThread() || mDecoder->OnDecodeThread(),
|
||||
"Should be on play state machine or decode thread.");
|
||||
mMonitor.AssertCurrentThreadIn();
|
||||
mReentrantMonitor.AssertCurrentThreadIn();
|
||||
|
||||
if (!aCodecState || !aCodecState->mActive) {
|
||||
return PR_FALSE;
|
||||
@ -917,7 +917,7 @@ VideoData* nsOggReader::FindStartTime(PRInt64 aOffset,
|
||||
|
||||
PRInt64 nsOggReader::FindEndTime(PRInt64 aEndOffset)
|
||||
{
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
NS_ASSERTION(mDecoder->OnStateMachineThread(),
|
||||
"Should be on state machine thread.");
|
||||
NS_ASSERTION(mDataOffset > 0,
|
||||
@ -1056,7 +1056,7 @@ nsresult nsOggReader::GetSeekRanges(nsTArray<SeekRange>& aRanges)
|
||||
{
|
||||
NS_ASSERTION(mDecoder->OnStateMachineThread(),
|
||||
"Should be on state machine thread.");
|
||||
mMonitor.AssertCurrentThreadIn();
|
||||
mReentrantMonitor.AssertCurrentThreadIn();
|
||||
nsTArray<nsByteRange> cached;
|
||||
nsresult res = mDecoder->GetCurrentStream()->GetCachedRanges(cached);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
@ -1236,8 +1236,8 @@ nsresult nsOggReader::SeekInBufferedRange(PRInt64 aTarget,
|
||||
PRBool skip = PR_FALSE;
|
||||
eof = !DecodeVideoFrame(skip, 0);
|
||||
{
|
||||
MonitorAutoExit exitReaderMon(mMonitor);
|
||||
MonitorAutoEnter decoderMon(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoExit exitReaderMon(mReentrantMonitor);
|
||||
ReentrantMonitorAutoEnter decoderMon(mDecoder->GetReentrantMonitor());
|
||||
if (mDecoder->GetDecodeState() == nsBuiltinDecoderStateMachine::DECODER_STATE_SHUTDOWN) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
@ -1316,7 +1316,7 @@ nsresult nsOggReader::Seek(PRInt64 aTarget,
|
||||
PRInt64 aEndTime,
|
||||
PRInt64 aCurrentTime)
|
||||
{
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
NS_ASSERTION(mDecoder->OnStateMachineThread(),
|
||||
"Should be on state machine thread.");
|
||||
LOG(PR_LOG_DEBUG, ("%p About to seek to %lldms", mDecoder, aTarget));
|
||||
@ -1336,8 +1336,8 @@ nsresult nsOggReader::Seek(PRInt64 aTarget,
|
||||
|
||||
NS_ASSERTION(aStartTime != -1, "mStartTime should be known");
|
||||
{
|
||||
MonitorAutoExit exitReaderMon(mMonitor);
|
||||
MonitorAutoEnter decoderMon(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoExit exitReaderMon(mReentrantMonitor);
|
||||
ReentrantMonitorAutoEnter decoderMon(mDecoder->GetReentrantMonitor());
|
||||
mDecoder->UpdatePlaybackPosition(aStartTime);
|
||||
}
|
||||
} else if (CanDecodeToTarget(aTarget, aCurrentTime)) {
|
||||
|
@ -80,13 +80,13 @@ public:
|
||||
|
||||
virtual PRBool HasAudio()
|
||||
{
|
||||
mozilla::MonitorAutoEnter mon(mMonitor);
|
||||
mozilla::ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
return mVorbisState != 0 && mVorbisState->mActive;
|
||||
}
|
||||
|
||||
virtual PRBool HasVideo()
|
||||
{
|
||||
mozilla::MonitorAutoEnter mon(mMonitor);
|
||||
mozilla::ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
return mTheoraState != 0 && mTheoraState->mActive;
|
||||
}
|
||||
|
||||
@ -98,7 +98,7 @@ private:
|
||||
|
||||
PRBool HasSkeleton()
|
||||
{
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
return mSkeletonState != 0 && mSkeletonState->mActive;
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ nsresult nsWaveReader::Init(nsBuiltinDecoderReader* aCloneDonor)
|
||||
nsresult nsWaveReader::ReadMetadata(nsVideoInfo* aInfo)
|
||||
{
|
||||
NS_ASSERTION(mDecoder->OnStateMachineThread(), "Should be on state machine thread.");
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
|
||||
PRBool loaded = LoadRIFFChunk() && LoadFormatChunk() && FindDataOffset();
|
||||
if (!loaded) {
|
||||
@ -167,8 +167,8 @@ nsresult nsWaveReader::ReadMetadata(nsVideoInfo* aInfo)
|
||||
|
||||
*aInfo = mInfo;
|
||||
|
||||
MonitorAutoExit exitReaderMon(mMonitor);
|
||||
MonitorAutoEnter decoderMon(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoExit exitReaderMon(mReentrantMonitor);
|
||||
ReentrantMonitorAutoEnter decoderMon(mDecoder->GetReentrantMonitor());
|
||||
|
||||
mDecoder->GetStateMachine()->SetDuration(
|
||||
static_cast<PRInt64>(BytesToTime(GetDataLength()) * USECS_PER_S));
|
||||
@ -178,7 +178,7 @@ nsresult nsWaveReader::ReadMetadata(nsVideoInfo* aInfo)
|
||||
|
||||
PRBool nsWaveReader::DecodeAudioData()
|
||||
{
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
NS_ASSERTION(mDecoder->OnStateMachineThread() || mDecoder->OnDecodeThread(),
|
||||
"Should be on state machine thread or decode thread.");
|
||||
|
||||
@ -246,7 +246,7 @@ PRBool nsWaveReader::DecodeAudioData()
|
||||
PRBool nsWaveReader::DecodeVideoFrame(PRBool &aKeyframeSkip,
|
||||
PRInt64 aTimeThreshold)
|
||||
{
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
NS_ASSERTION(mDecoder->OnStateMachineThread() || mDecoder->OnDecodeThread(),
|
||||
"Should be on state machine or decode thread.");
|
||||
|
||||
@ -255,7 +255,7 @@ PRBool nsWaveReader::DecodeVideoFrame(PRBool &aKeyframeSkip,
|
||||
|
||||
nsresult nsWaveReader::Seek(PRInt64 aTarget, PRInt64 aStartTime, PRInt64 aEndTime, PRInt64 aCurrentTime)
|
||||
{
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
NS_ASSERTION(mDecoder->OnStateMachineThread(),
|
||||
"Should be on state machine thread.");
|
||||
LOG(PR_LOG_DEBUG, ("%p About to seek to %lld", mDecoder, aTarget));
|
||||
@ -477,7 +477,7 @@ nsWaveReader::LoadFormatChunk()
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
MonitorAutoEnter monitor(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoEnter monitor(mDecoder->GetReentrantMonitor());
|
||||
mSampleRate = rate;
|
||||
mChannels = channels;
|
||||
mSampleSize = sampleSize;
|
||||
@ -509,7 +509,7 @@ nsWaveReader::FindDataOffset()
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
MonitorAutoEnter monitor(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoEnter monitor(mDecoder->GetReentrantMonitor());
|
||||
mWaveLength = length;
|
||||
mWavePCMOffset = PRUint32(offset);
|
||||
return PR_TRUE;
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include "nsTimeRanges.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
using mozilla::MonitorAutoEnter;
|
||||
using mozilla::ReentrantMonitorAutoEnter;
|
||||
|
||||
static const double NS_PER_S = 1e9;
|
||||
|
||||
@ -66,7 +66,7 @@ VIntLength(unsigned char aFirstByte, PRUint32* aMask)
|
||||
|
||||
void nsWebMBufferedParser::Append(const unsigned char* aBuffer, PRUint32 aLength,
|
||||
nsTArray<nsWebMTimeDataOffset>& aMapping,
|
||||
Monitor& aMonitor)
|
||||
ReentrantMonitor& aReentrantMonitor)
|
||||
{
|
||||
static const unsigned char CLUSTER_ID[] = { 0x1f, 0x43, 0xb6, 0x75 };
|
||||
static const unsigned char TIMECODE_ID = 0xe7;
|
||||
@ -171,7 +171,7 @@ void nsWebMBufferedParser::Append(const unsigned char* aBuffer, PRUint32 aLength
|
||||
// It's possible we've parsed this data before, so avoid inserting
|
||||
// duplicate nsWebMTimeDataOffset entries.
|
||||
{
|
||||
MonitorAutoEnter mon(aMonitor);
|
||||
ReentrantMonitorAutoEnter mon(aReentrantMonitor);
|
||||
PRUint32 idx;
|
||||
if (!aMapping.GreatestIndexLtEq(mBlockOffset, idx)) {
|
||||
nsWebMTimeDataOffset entry(mBlockOffset, mClusterTimecode + mBlockTimecode);
|
||||
@ -214,7 +214,7 @@ void nsWebMBufferedState::CalculateBufferedForRange(nsTimeRanges* aBuffered,
|
||||
PRUint64 aTimecodeScale,
|
||||
PRInt64 aStartTimeOffsetNS)
|
||||
{
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
|
||||
// Find the first nsWebMTimeDataOffset at or after aStartOffset.
|
||||
PRUint32 start;
|
||||
@ -286,7 +286,7 @@ void nsWebMBufferedState::NotifyDataArrived(const char* aBuffer, PRUint32 aLengt
|
||||
mRangeParsers[idx].Append(reinterpret_cast<const unsigned char*>(aBuffer),
|
||||
aLength,
|
||||
mTimeMapping,
|
||||
mMonitor);
|
||||
mReentrantMonitor);
|
||||
|
||||
// Merge parsers with overlapping regions and clean up the remnants.
|
||||
PRUint32 i = 0;
|
||||
|
@ -40,10 +40,10 @@
|
||||
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsTArray.h"
|
||||
#include "mozilla/Monitor.h"
|
||||
#include "mozilla/ReentrantMonitor.h"
|
||||
|
||||
class nsTimeRanges;
|
||||
using mozilla::Monitor;
|
||||
using mozilla::ReentrantMonitor;
|
||||
|
||||
// Stores a stream byte offset and the scaled timecode of the block at
|
||||
// that offset. The timecode must be scaled by the stream's timecode
|
||||
@ -80,10 +80,10 @@ struct nsWebMBufferedParser
|
||||
|
||||
// Steps the parser through aLength bytes of data. Always consumes
|
||||
// aLength bytes. Updates mCurrentOffset before returning. Acquires
|
||||
// aMonitor before using aMapping.
|
||||
// aReentrantMonitor before using aMapping.
|
||||
void Append(const unsigned char* aBuffer, PRUint32 aLength,
|
||||
nsTArray<nsWebMTimeDataOffset>& aMapping,
|
||||
Monitor& aMonitor);
|
||||
ReentrantMonitor& aReentrantMonitor);
|
||||
|
||||
bool operator==(PRInt64 aOffset) const {
|
||||
return mCurrentOffset == aOffset;
|
||||
@ -216,7 +216,7 @@ class nsWebMBufferedState
|
||||
NS_INLINE_DECL_REFCOUNTING(nsWebMBufferedState)
|
||||
|
||||
public:
|
||||
nsWebMBufferedState() : mMonitor("nsWebMBufferedState") {
|
||||
nsWebMBufferedState() : mReentrantMonitor("nsWebMBufferedState") {
|
||||
MOZ_COUNT_CTOR(nsWebMBufferedState);
|
||||
}
|
||||
|
||||
@ -232,7 +232,7 @@ public:
|
||||
|
||||
private:
|
||||
// Synchronizes access to the mTimeMapping array.
|
||||
Monitor mMonitor;
|
||||
ReentrantMonitor mReentrantMonitor;
|
||||
|
||||
// Sorted (by offset) map of data offsets to timecodes. Populated
|
||||
// on the main thread as data is received and parsed by nsWebMBufferedParsers.
|
||||
|
@ -211,7 +211,7 @@ void nsWebMReader::Cleanup()
|
||||
nsresult nsWebMReader::ReadMetadata(nsVideoInfo* aInfo)
|
||||
{
|
||||
NS_ASSERTION(mDecoder->OnStateMachineThread(), "Should be on state machine thread.");
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
|
||||
nestegg_io io;
|
||||
io.read = webm_read;
|
||||
@ -226,8 +226,8 @@ nsresult nsWebMReader::ReadMetadata(nsVideoInfo* aInfo)
|
||||
uint64_t duration = 0;
|
||||
r = nestegg_duration(mContext, &duration);
|
||||
if (r == 0) {
|
||||
MonitorAutoExit exitReaderMon(mMonitor);
|
||||
MonitorAutoEnter decoderMon(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoExit exitReaderMon(mReentrantMonitor);
|
||||
ReentrantMonitorAutoEnter decoderMon(mDecoder->GetReentrantMonitor());
|
||||
mDecoder->GetStateMachine()->SetDuration(duration / NS_PER_USEC);
|
||||
}
|
||||
|
||||
@ -413,7 +413,7 @@ ogg_packet nsWebMReader::InitOggPacket(unsigned char* aData,
|
||||
|
||||
PRBool nsWebMReader::DecodeAudioPacket(nestegg_packet* aPacket, PRInt64 aOffset)
|
||||
{
|
||||
mMonitor.AssertCurrentThreadIn();
|
||||
mReentrantMonitor.AssertCurrentThreadIn();
|
||||
|
||||
int r = 0;
|
||||
unsigned int count = 0;
|
||||
@ -591,7 +591,7 @@ nsReturnRef<NesteggPacketHolder> nsWebMReader::NextPacket(TrackType aTrackType)
|
||||
|
||||
PRBool nsWebMReader::DecodeAudioData()
|
||||
{
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
NS_ASSERTION(mDecoder->OnStateMachineThread() || mDecoder->OnDecodeThread(),
|
||||
"Should be on state machine thread or decode thread.");
|
||||
nsAutoRef<NesteggPacketHolder> holder(NextPacket(AUDIO));
|
||||
@ -606,7 +606,7 @@ PRBool nsWebMReader::DecodeAudioData()
|
||||
PRBool nsWebMReader::DecodeVideoFrame(PRBool &aKeyframeSkip,
|
||||
PRInt64 aTimeThreshold)
|
||||
{
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
NS_ASSERTION(mDecoder->OnStateMachineThread() || mDecoder->OnDecodeThread(),
|
||||
"Should be on state machine or decode thread.");
|
||||
|
||||
@ -654,8 +654,8 @@ PRBool nsWebMReader::DecodeVideoFrame(PRBool &aKeyframeSkip,
|
||||
}
|
||||
mVideoPackets.PushFront(next_holder.disown());
|
||||
} else {
|
||||
MonitorAutoExit exitMon(mMonitor);
|
||||
MonitorAutoEnter decoderMon(mDecoder->GetMonitor());
|
||||
ReentrantMonitorAutoExit exitMon(mReentrantMonitor);
|
||||
ReentrantMonitorAutoEnter decoderMon(mDecoder->GetReentrantMonitor());
|
||||
nsBuiltinDecoderStateMachine* s =
|
||||
static_cast<nsBuiltinDecoderStateMachine*>(mDecoder->GetStateMachine());
|
||||
PRInt64 endTime = s->GetEndMediaTime();
|
||||
@ -756,7 +756,7 @@ PRBool nsWebMReader::CanDecodeToTarget(PRInt64 aTarget,
|
||||
nsresult nsWebMReader::Seek(PRInt64 aTarget, PRInt64 aStartTime, PRInt64 aEndTime,
|
||||
PRInt64 aCurrentTime)
|
||||
{
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
NS_ASSERTION(mDecoder->OnStateMachineThread(),
|
||||
"Should be on state machine thread.");
|
||||
LOG(PR_LOG_DEBUG, ("%p About to seek to %lldms", mDecoder, aTarget));
|
||||
|
@ -143,13 +143,13 @@ public:
|
||||
|
||||
virtual PRBool HasAudio()
|
||||
{
|
||||
mozilla::MonitorAutoEnter mon(mMonitor);
|
||||
mozilla::ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
return mHasAudio;
|
||||
}
|
||||
|
||||
virtual PRBool HasVideo()
|
||||
{
|
||||
mozilla::MonitorAutoEnter mon(mMonitor);
|
||||
mozilla::ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
return mHasVideo;
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,6 @@
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIDOMAbstractView.h"
|
||||
|
||||
nsDOMTimeEvent::nsDOMTimeEvent(nsPresContext* aPresContext, nsEvent* aEvent)
|
||||
: nsDOMEvent(aPresContext, aEvent ? aEvent : new nsUIEvent(PR_FALSE, 0, 0)),
|
||||
@ -92,7 +91,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMTimeEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMTimeEvent::GetView(nsIDOMAbstractView** aView)
|
||||
nsDOMTimeEvent::GetView(nsIDOMWindow** aView)
|
||||
{
|
||||
*aView = mView;
|
||||
NS_IF_ADDREF(*aView);
|
||||
@ -108,7 +107,7 @@ nsDOMTimeEvent::GetDetail(PRInt32* aDetail)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMTimeEvent::InitTimeEvent(const nsAString& aTypeArg,
|
||||
nsIDOMAbstractView* aViewArg,
|
||||
nsIDOMWindow* aViewArg,
|
||||
PRInt32 aDetailArg)
|
||||
{
|
||||
nsresult rv = nsDOMEvent::InitEvent(aTypeArg, PR_FALSE /*doesn't bubble*/,
|
||||
|
@ -58,8 +58,8 @@ public:
|
||||
NS_FORWARD_TO_NSDOMEVENT
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIDOMAbstractView> mView;
|
||||
PRInt32 mDetail;
|
||||
nsCOMPtr<nsIDOMWindow> mView;
|
||||
PRInt32 mDetail;
|
||||
};
|
||||
|
||||
#endif // NS_DOMTIMEEVENT_H_
|
||||
|
@ -51,8 +51,6 @@
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsDOMError.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIDOMViewCSS.h"
|
||||
#include "nsIDOMCSSStyleDeclaration.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIXBLService.h"
|
||||
#include "nsGkAtoms.h"
|
||||
|
@ -54,11 +54,31 @@
|
||||
#include "nsCharSeparatedTokenizer.h"
|
||||
#include "nsStyleUtil.h"
|
||||
#include "nsSVGUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIPrefService.h"
|
||||
|
||||
/*static*/ PRBool
|
||||
nsSVGFeatures::HaveFeature(const nsAString& aFeature)
|
||||
nsSVGFeatures::HaveFeature(nsISupports* aObject, const nsAString& aFeature)
|
||||
{
|
||||
#define SVG_SUPPORTED_FEATURE(str) if (aFeature.Equals(NS_LITERAL_STRING(str).get())) return PR_TRUE;
|
||||
if (aFeature.EqualsLiteral("http://www.w3.org/TR/SVG11/feature#Script")) {
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aObject));
|
||||
if (content) {
|
||||
nsIDocument *doc = content->GetCurrentDoc();
|
||||
if (doc && doc->IsResourceDoc()) {
|
||||
// no scripting in SVG images or external resource documents
|
||||
return PR_FALSE;
|
||||
}
|
||||
}
|
||||
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
|
||||
if (prefs) {
|
||||
PRBool js;
|
||||
if (NS_SUCCEEDED(prefs->GetBoolPref("javascript.enabled", &js))) {
|
||||
return js;
|
||||
}
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
#define SVG_SUPPORTED_FEATURE(str) if (aFeature.EqualsLiteral(str)) return PR_TRUE;
|
||||
#define SVG_UNSUPPORTED_FEATURE(str)
|
||||
#include "nsSVGFeaturesList.h"
|
||||
#undef SVG_SUPPORTED_FEATURE
|
||||
@ -67,11 +87,11 @@ nsSVGFeatures::HaveFeature(const nsAString& aFeature)
|
||||
}
|
||||
|
||||
/*static*/ PRBool
|
||||
nsSVGFeatures::HaveFeatures(const nsSubstring& aFeatures)
|
||||
nsSVGFeatures::HaveFeatures(nsISupports* aObject, const nsSubstring& aFeatures)
|
||||
{
|
||||
nsWhitespaceTokenizer tokenizer(aFeatures);
|
||||
while (tokenizer.hasMoreTokens()) {
|
||||
if (!HaveFeature(tokenizer.nextToken())) {
|
||||
if (!HaveFeature(aObject, tokenizer.nextToken())) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
}
|
||||
@ -81,7 +101,7 @@ nsSVGFeatures::HaveFeatures(const nsSubstring& aFeatures)
|
||||
/*static*/ PRBool
|
||||
nsSVGFeatures::HaveExtension(const nsAString& aExtension)
|
||||
{
|
||||
#define SVG_SUPPORTED_EXTENSION(str) if (aExtension.Equals(NS_LITERAL_STRING(str).get())) return PR_TRUE;
|
||||
#define SVG_SUPPORTED_EXTENSION(str) if (aExtension.EqualsLiteral(str)) return PR_TRUE;
|
||||
SVG_SUPPORTED_EXTENSION("http://www.w3.org/1999/xhtml")
|
||||
#ifdef MOZ_MATHML
|
||||
SVG_SUPPORTED_EXTENSION("http://www.w3.org/1998/Math/MathML")
|
||||
@ -186,7 +206,7 @@ nsSVGFeatures::PassesConditionalProcessingTests(nsIContent *aContent,
|
||||
// Required Features
|
||||
nsAutoString value;
|
||||
if (aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::requiredFeatures, value)) {
|
||||
if (value.IsEmpty() || !HaveFeatures(value)) {
|
||||
if (value.IsEmpty() || !HaveFeatures(aContent, value)) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -50,11 +50,13 @@ public:
|
||||
/**
|
||||
* Check whether we support the given feature string.
|
||||
*
|
||||
* @param aObject the object, which should support the feature,
|
||||
* for example nsIDOMNode or nsIDOMDOMImplementation
|
||||
* @param aFeature one of the feature strings specified at
|
||||
* http://www.w3.org/TR/SVG11/feature.html
|
||||
*/
|
||||
static PRBool
|
||||
HaveFeature(const nsAString& aFeature);
|
||||
HaveFeature(nsISupports* aObject, const nsAString& aFeature);
|
||||
|
||||
/**
|
||||
* Compare the language name(s) in a systemLanguage attribute to the
|
||||
@ -97,11 +99,13 @@ private:
|
||||
/**
|
||||
* Check whether we support the given list of feature strings.
|
||||
*
|
||||
* @param aObject the object, which should support the feature,
|
||||
* for example nsIDOMNode or nsIDOMDOMImplementation
|
||||
* @param aFeatures a whitespace separated list containing one or more of the
|
||||
* feature strings specified at http://www.w3.org/TR/SVG11/feature.html
|
||||
*/
|
||||
static PRBool
|
||||
HaveFeatures(const nsSubstring& aFeatures);
|
||||
HaveFeatures(nsISupports* aObject, const nsSubstring& aFeatures);
|
||||
|
||||
/**
|
||||
* Check whether we support the given extension string.
|
||||
|
@ -81,7 +81,6 @@ SVG_SUPPORTED_FEATURE("http://www.w3.org/TR/SVG11/feature#Hyperlinking")
|
||||
SVG_SUPPORTED_FEATURE("http://www.w3.org/TR/SVG11/feature#XlinkAttribute")
|
||||
SVG_UNSUPPORTED_FEATURE("http://www.w3.org/TR/SVG11/feature#ExternalResourcesRequired")
|
||||
SVG_UNSUPPORTED_FEATURE("http://www.w3.org/TR/SVG11/feature#View")
|
||||
SVG_SUPPORTED_FEATURE("http://www.w3.org/TR/SVG11/feature#Script")
|
||||
SVG_UNSUPPORTED_FEATURE("http://www.w3.org/TR/SVG11/feature#Font")
|
||||
SVG_UNSUPPORTED_FEATURE("http://www.w3.org/TR/SVG11/feature#BasicFont")
|
||||
SVG_SUPPORTED_FEATURE("http://www.w3.org/TR/SVG11/feature#Extensibility")
|
||||
|
@ -127,6 +127,7 @@ nsSVGNumber2::SetBaseValueString(const nsAString &aValueAsString,
|
||||
}
|
||||
|
||||
mBaseVal = val;
|
||||
mIsBaseSet = PR_TRUE;
|
||||
if (!mIsAnimated) {
|
||||
mAnimVal = mBaseVal;
|
||||
}
|
||||
@ -155,6 +156,7 @@ nsSVGNumber2::SetBaseValue(float aValue,
|
||||
PRBool aDoSetAttr)
|
||||
{
|
||||
mBaseVal = aValue;
|
||||
mIsBaseSet = PR_TRUE;
|
||||
if (!mIsAnimated) {
|
||||
mAnimVal = mBaseVal;
|
||||
}
|
||||
|
@ -56,6 +56,7 @@ public:
|
||||
mAnimVal = mBaseVal = aValue;
|
||||
mAttrEnum = aAttrEnum;
|
||||
mIsAnimated = PR_FALSE;
|
||||
mIsBaseSet = PR_FALSE;
|
||||
}
|
||||
|
||||
nsresult SetBaseValueString(const nsAString& aValue,
|
||||
@ -70,6 +71,14 @@ public:
|
||||
float GetAnimValue() const
|
||||
{ return mAnimVal; }
|
||||
|
||||
// Returns PR_TRUE if the animated value of this number has been explicitly
|
||||
// set (either by animation, or by taking on the base value which has been
|
||||
// explicitly set by markup or a DOM call), PR_FALSE otherwise.
|
||||
// If this returns PR_FALSE, the animated value is still valid, that is,
|
||||
// useable, and represents the default base value of the attribute.
|
||||
PRBool IsExplicitlySet() const
|
||||
{ return mIsAnimated || mIsBaseSet; }
|
||||
|
||||
nsresult ToDOMAnimatedNumber(nsIDOMSVGAnimatedNumber **aResult,
|
||||
nsSVGElement* aSVGElement);
|
||||
#ifdef MOZ_SMIL
|
||||
@ -83,6 +92,7 @@ private:
|
||||
float mBaseVal;
|
||||
PRUint8 mAttrEnum; // element specified tracking for attribute
|
||||
PRPackedBool mIsAnimated;
|
||||
PRPackedBool mIsBaseSet;
|
||||
|
||||
public:
|
||||
struct DOMAnimatedNumber : public nsIDOMSVGAnimatedNumber
|
||||
|
@ -122,8 +122,11 @@ nsSVGPathElement::GetPointAtLength(float distance, nsIDOMSVGPoint **_retval)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
float totalLength = flat->GetLength();
|
||||
if (HasAttr(kNameSpaceID_None, nsGkAtoms::pathLength)) {
|
||||
if (mPathLength.IsExplicitlySet()) {
|
||||
float pathLength = mPathLength.GetAnimValue();
|
||||
if (pathLength <= 0) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
distance *= totalLength / pathLength;
|
||||
}
|
||||
distance = NS_MAX(0.f, distance);
|
||||
@ -400,11 +403,8 @@ nsSVGPathElement::GetFlattenedPath(const gfxMatrix &aMatrix)
|
||||
PRBool
|
||||
nsSVGPathElement::AttributeDefinesGeometry(const nsIAtom *aName)
|
||||
{
|
||||
if (aName == nsGkAtoms::d ||
|
||||
aName == nsGkAtoms::pathLength)
|
||||
return PR_TRUE;
|
||||
|
||||
return PR_FALSE;
|
||||
return aName == nsGkAtoms::d ||
|
||||
aName == nsGkAtoms::pathLength;
|
||||
}
|
||||
|
||||
PRBool
|
||||
@ -425,3 +425,18 @@ nsSVGPathElement::ConstructPath(gfxContext *aCtx)
|
||||
mD.GetAnimValue().ConstructPath(aCtx);
|
||||
}
|
||||
|
||||
gfxFloat
|
||||
nsSVGPathElement::GetScale()
|
||||
{
|
||||
if (mPathLength.IsExplicitlySet()) {
|
||||
|
||||
nsRefPtr<gfxFlattenedPath> flat =
|
||||
GetFlattenedPath(PrependLocalTransformTo(gfxMatrix()));
|
||||
float pathLength = mPathLength.GetAnimValue();
|
||||
|
||||
if (flat && pathLength != 0) {
|
||||
return flat->GetLength() / pathLength;
|
||||
}
|
||||
}
|
||||
return 1.0;
|
||||
}
|
||||
|
@ -55,7 +55,6 @@ class nsSVGPathElement : public nsSVGPathElementBase,
|
||||
public nsIDOMSVGAnimatedPathData
|
||||
{
|
||||
friend class nsSVGPathFrame;
|
||||
friend class nsSVGTextPathFrame;
|
||||
|
||||
protected:
|
||||
friend nsresult NS_NewSVGPathElement(nsIContent **aResult,
|
||||
@ -99,6 +98,8 @@ public:
|
||||
return nsGkAtoms::d;
|
||||
}
|
||||
|
||||
gfxFloat GetScale();
|
||||
|
||||
protected:
|
||||
|
||||
// nsSVGElement method
|
||||
|
@ -73,6 +73,7 @@ _TEST_FILES = \
|
||||
test_nonAnimStrings.xhtml \
|
||||
test_pathAnimInterpolation.xhtml \
|
||||
test_pathSeg.xhtml \
|
||||
test_pointAtLength.xhtml \
|
||||
test_pointer-events.xhtml \
|
||||
test_pointer-events-2.xhtml \
|
||||
test_scientific.html \
|
||||
|
50
content/svg/content/test/test_pointAtLength.xhtml
Normal file
50
content/svg/content/test/test_pointAtLength.xhtml
Normal file
@ -0,0 +1,50 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=643419
|
||||
-->
|
||||
<head>
|
||||
<title>Test getPointAtLength</title>
|
||||
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<script class="testbody" type="text/javascript">
|
||||
<![CDATA[
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function run()
|
||||
{
|
||||
var p1 = document.getElementById("p1");
|
||||
var point = p1.getPointAtLength(200);
|
||||
is(point.x, 200);
|
||||
is(point.y, 50);
|
||||
|
||||
// set the pathLength to twice its actual length
|
||||
p1.setAttribute("pathLength", "800");
|
||||
var point = p1.getPointAtLength(200);
|
||||
is(point.x, 100);
|
||||
is(point.y, 50);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
window.addEventListener("load", run, false);
|
||||
]]>
|
||||
</script>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=643419">Mozilla Bug 643419</a>
|
||||
<p id="display"></p>
|
||||
<div id="content">
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="750">
|
||||
<defs>
|
||||
<path id="p1" d="M 0 50 h 400"/>
|
||||
</defs>
|
||||
</svg>
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -882,7 +882,7 @@ nsXBLService::GetBinding(nsIContent* aBoundElement, nsIURI* aURI,
|
||||
|
||||
nsXBLPrototypeBinding* protoBinding = docInfo->GetPrototypeBinding(ref);
|
||||
|
||||
NS_ASSERTION(protoBinding, "Unable to locate an XBL binding.");
|
||||
NS_WARN_IF_FALSE(protoBinding, "Unable to locate an XBL binding");
|
||||
if (!protoBinding)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
@ -38,10 +38,7 @@
|
||||
|
||||
#include "nsXMLPrettyPrinter.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIDOMDocumentView.h"
|
||||
#include "nsIDOMAbstractView.h"
|
||||
#include "nsIDOMCSSStyleDeclaration.h"
|
||||
#include "nsIDOMViewCSS.h"
|
||||
#include "nsIDOMDocumentXBL.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsIXSLTProcessor.h"
|
||||
@ -95,16 +92,13 @@ nsXMLPrettyPrinter::PrettyPrint(nsIDocument* aDocument,
|
||||
nsCOMPtr<nsIDOMCSSStyleDeclaration> computedStyle;
|
||||
nsCOMPtr<nsIDOMDocument> frameOwnerDoc;
|
||||
frameElem->GetOwnerDocument(getter_AddRefs(frameOwnerDoc));
|
||||
nsCOMPtr<nsIDOMDocumentView> docView = do_QueryInterface(frameOwnerDoc);
|
||||
if (docView) {
|
||||
nsCOMPtr<nsIDOMAbstractView> defaultView;
|
||||
docView->GetDefaultView(getter_AddRefs(defaultView));
|
||||
nsCOMPtr<nsIDOMViewCSS> defaultCSSView =
|
||||
do_QueryInterface(defaultView);
|
||||
if (defaultCSSView) {
|
||||
defaultCSSView->GetComputedStyle(frameElem,
|
||||
EmptyString(),
|
||||
getter_AddRefs(computedStyle));
|
||||
if (frameOwnerDoc) {
|
||||
nsCOMPtr<nsIDOMWindow> window;
|
||||
frameOwnerDoc->GetDefaultView(getter_AddRefs(window));
|
||||
if (window) {
|
||||
window->GetComputedStyle(frameElem,
|
||||
EmptyString(),
|
||||
getter_AddRefs(computedStyle));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
@ -119,7 +118,6 @@
|
||||
#include "nsXULDocument.h"
|
||||
#include "nsXULPopupListener.h"
|
||||
#include "nsRuleWalker.h"
|
||||
#include "nsIDOMViewCSS.h"
|
||||
#include "nsIDOMCSSStyleDeclaration.h"
|
||||
#include "nsCSSParser.h"
|
||||
#include "nsIListBoxObject.h"
|
||||
|
@ -50,7 +50,6 @@ DIRS = \
|
||||
interfaces/html \
|
||||
interfaces/events \
|
||||
interfaces/stylesheets \
|
||||
interfaces/views \
|
||||
interfaces/sidebar \
|
||||
interfaces/css \
|
||||
interfaces/traversal \
|
||||
|
@ -192,7 +192,6 @@
|
||||
#include "nsBindingManager.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIDOMViewCSS.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMCSSStyleDeclaration.h"
|
||||
#include "nsStyleSet.h"
|
||||
@ -253,7 +252,6 @@
|
||||
#include "nsIDOMDocumentRange.h"
|
||||
#include "nsIDOMDocumentTraversal.h"
|
||||
#include "nsIDOMDocumentXBL.h"
|
||||
#include "nsIDOMDocumentView.h"
|
||||
#include "nsIDOMElementCSSInlineStyle.h"
|
||||
#include "nsIDOMLinkStyle.h"
|
||||
#include "nsIDOMHTMLDocument.h"
|
||||
@ -338,7 +336,7 @@
|
||||
#include "nsIDOMCSSStyleRule.h"
|
||||
#include "nsIDOMCSSStyleSheet.h"
|
||||
#include "nsDOMCSSValueList.h"
|
||||
#include "nsIDOMOrientationEvent.h"
|
||||
#include "nsIDOMDeviceOrientationEvent.h"
|
||||
#include "nsIDOMRange.h"
|
||||
#include "nsIDOMNSRange.h"
|
||||
#include "nsIDOMRangeException.h"
|
||||
@ -748,7 +746,7 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(PopupBlockedEvent, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(OrientationEvent, nsDOMGenericSH,
|
||||
NS_DEFINE_CLASSINFO_DATA(DeviceOrientationEvent, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
// Misc HTML classes
|
||||
@ -2303,7 +2301,6 @@ nsDOMClassInfo::RegisterExternalClasses()
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentEvent) \
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentStyle) \
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSDocumentStyle) \
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentView) \
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentRange) \
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentTraversal) \
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentXBL) \
|
||||
@ -2380,8 +2377,6 @@ nsDOMClassInfo::Init()
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMViewCSS)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMAbstractView)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageIndexedDB)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow_2_0_BRANCH)
|
||||
@ -2393,8 +2388,6 @@ nsDOMClassInfo::Init()
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMViewCSS)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMAbstractView)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow_2_0_BRANCH)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
@ -2574,8 +2567,8 @@ nsDOMClassInfo::Init()
|
||||
DOM_CLASSINFO_EVENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(OrientationEvent, nsIDOMOrientationEvent)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMOrientationEvent)
|
||||
DOM_CLASSINFO_MAP_BEGIN(DeviceOrientationEvent, nsIDOMDeviceOrientationEvent)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDeviceOrientationEvent)
|
||||
DOM_CLASSINFO_EVENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
@ -3128,8 +3121,6 @@ nsDOMClassInfo::Init()
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageIndexedDB)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMViewCSS)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMAbstractView)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(RangeException, nsIDOMRangeException)
|
||||
@ -4023,8 +4014,6 @@ nsDOMClassInfo::Init()
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMViewCSS)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMAbstractView)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageIndexedDB)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMModalContentWindow)
|
||||
|
@ -76,7 +76,7 @@ DOMCI_CLASS(MouseScrollEvent)
|
||||
DOMCI_CLASS(DragEvent)
|
||||
DOMCI_CLASS(KeyboardEvent)
|
||||
DOMCI_CLASS(PopupBlockedEvent)
|
||||
DOMCI_CLASS(OrientationEvent)
|
||||
DOMCI_CLASS(DeviceOrientationEvent)
|
||||
|
||||
// HTML classes
|
||||
DOMCI_CLASS(HTMLDocument)
|
||||
|
@ -80,7 +80,6 @@
|
||||
#include "nsFrameSelection.h"
|
||||
#include "nsXULPopupManager.h"
|
||||
#include "nsImageMapUtils.h"
|
||||
#include "nsTreeWalker.h"
|
||||
#include "nsIDOMNodeFilter.h"
|
||||
#include "nsIScriptObjectPrincipal.h"
|
||||
#include "nsIPrincipal.h"
|
||||
@ -2603,18 +2602,12 @@ nsFocusManager::GetNextTabbableContent(nsIPresShell* aPresShell,
|
||||
return NS_OK;
|
||||
|
||||
// look for the next or previous content node in tree order
|
||||
nsTreeWalker walker(aRootContent, nsIDOMNodeFilter::SHOW_ALL, nsnull, PR_TRUE);
|
||||
nsCOMPtr<nsIDOMNode> nextNode = do_QueryInterface(iterStartContent);
|
||||
walker.SetCurrentNode(nextNode);
|
||||
if (NS_SUCCEEDED(aForward ? walker.NextNode(getter_AddRefs(nextNode)) :
|
||||
walker.PreviousNode(getter_AddRefs(nextNode)))) {
|
||||
iterStartContent = do_QueryInterface(nextNode);
|
||||
// we've already skipped over the initial focused content, so we
|
||||
// don't want to traverse frames.
|
||||
getNextFrame = PR_FALSE;
|
||||
if (iterStartContent)
|
||||
continue;
|
||||
}
|
||||
iterStartContent = aForward ? iterStartContent->GetNextNode() : iterStartContent->GetPreviousContent();
|
||||
// we've already skipped over the initial focused content, so we
|
||||
// don't want to traverse frames.
|
||||
getNextFrame = PR_FALSE;
|
||||
if (iterStartContent)
|
||||
continue;
|
||||
|
||||
// otherwise, as a last attempt, just look at the root content
|
||||
iterStartContent = aRootContent;
|
||||
|
@ -111,7 +111,6 @@
|
||||
#endif
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMNSDocument.h"
|
||||
#include "nsIDOMDocumentView.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMDocumentEvent.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
@ -1334,8 +1333,6 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsGlobalWindow)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOM3EventTarget)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNSEventTarget)
|
||||
NS_INTERFACE_MAP_ENTRY(nsPIDOMWindow)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMViewCSS)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMAbstractView)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMStorageWindow)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMStorageIndexedDB)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
||||
@ -7888,10 +7885,6 @@ nsGlobalWindow::UpdateCanvasFocus(PRBool aFocusChanged, nsIContent* aNewContent)
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsGlobalWindow::nsIDOMViewCSS
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGlobalWindow::GetComputedStyle(nsIDOMElement* aElt,
|
||||
const nsAString& aPseudoElt,
|
||||
@ -7928,27 +7921,6 @@ nsGlobalWindow::GetComputedStyle(nsIDOMElement* aElt,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsGlobalWindow::nsIDOMAbstractView
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGlobalWindow::GetDocument(nsIDOMDocumentView ** aDocumentView)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aDocumentView);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (mDocument) {
|
||||
rv = CallQueryInterface(mDocument, aDocumentView);
|
||||
}
|
||||
else {
|
||||
*aDocumentView = nsnull;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsGlobalWindow::nsIDOMStorageWindow
|
||||
//*****************************************************************************
|
||||
|
@ -62,7 +62,6 @@
|
||||
#include "nsIDocShellTreeOwner.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIDOMClientInformation.h"
|
||||
#include "nsIDOMViewCSS.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOM3EventTarget.h"
|
||||
#include "nsIDOMNSEventTarget.h"
|
||||
@ -280,7 +279,6 @@ class nsGlobalWindow : public nsPIDOMWindow,
|
||||
public nsPIDOMEventTarget,
|
||||
public nsIDOM3EventTarget,
|
||||
public nsIDOMNSEventTarget,
|
||||
public nsIDOMViewCSS,
|
||||
public nsIDOMStorageWindow,
|
||||
public nsIDOMStorageIndexedDB,
|
||||
public nsSupportsWeakReference,
|
||||
@ -419,12 +417,6 @@ public:
|
||||
virtual NS_HIDDEN_(void) MaybeUpdateTouchState();
|
||||
virtual NS_HIDDEN_(void) UpdateTouchState();
|
||||
|
||||
// nsIDOMViewCSS
|
||||
NS_DECL_NSIDOMVIEWCSS
|
||||
|
||||
// nsIDOMAbstractView
|
||||
NS_DECL_NSIDOMABSTRACTVIEW
|
||||
|
||||
// nsIDOMStorageWindow
|
||||
NS_DECL_NSIDOMSTORAGEWINDOW
|
||||
|
||||
|
@ -120,7 +120,12 @@ CheckPermissionsHelper::Run()
|
||||
|
||||
nsresult rv;
|
||||
if (mHasPrompted) {
|
||||
if (permission != nsIPermissionManager::UNKNOWN_ACTION) {
|
||||
// Add permissions to the database, but only if we are in the parent
|
||||
// process (if we are in the child process, we have already
|
||||
// set the permission when the prompt was shown in the parent, as
|
||||
// we cannot set the permission from the child).
|
||||
if (permission != nsIPermissionManager::UNKNOWN_ACTION &&
|
||||
XRE_GetProcessType() == GeckoProcessType_Default) {
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
rv = NS_NewURI(getter_AddRefs(uri), mASCIIOrigin);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsIScriptObjectPrincipal.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsNetUtil.h"
|
||||
@ -180,7 +181,12 @@ CheckQuotaHelper::Run()
|
||||
|
||||
nsresult rv;
|
||||
if (mHasPrompted) {
|
||||
if (mPromptResult != nsIPermissionManager::UNKNOWN_ACTION) {
|
||||
// Add permissions to the database, but only if we are in the parent
|
||||
// process (if we are in the child process, we have already
|
||||
// set the permission when the prompt was shown in the parent, as
|
||||
// we cannot set the permission from the child).
|
||||
if (mPromptResult != nsIPermissionManager::UNKNOWN_ACTION &&
|
||||
XRE_GetProcessType() == GeckoProcessType_Default) {
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
rv = NS_NewURI(getter_AddRefs(uri), mOrigin);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -37,12 +37,15 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "base/basictypes.h"
|
||||
|
||||
#include "IDBFactory.h"
|
||||
|
||||
#include "nsILocalFile.h"
|
||||
#include "nsIScriptContext.h"
|
||||
|
||||
#include "mozilla/storage.h"
|
||||
#include "mozilla/dom/ContentChild.h"
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsContentUtils.h"
|
||||
@ -54,6 +57,7 @@
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsXPCOMCID.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
#include "AsyncConnectionHelper.h"
|
||||
#include "CheckPermissionsHelper.h"
|
||||
@ -62,6 +66,7 @@
|
||||
#include "IDBKeyRange.h"
|
||||
#include "IndexedDatabaseManager.h"
|
||||
#include "LazyIdleThread.h"
|
||||
#include "nsIObserverService.h"
|
||||
|
||||
#define PREF_INDEXEDDB_QUOTA "dom.indexedDB.warningQuota"
|
||||
|
||||
@ -76,6 +81,8 @@ USING_INDEXEDDB_NAMESPACE
|
||||
|
||||
namespace {
|
||||
|
||||
GeckoProcessType gAllowedProcessType = GeckoProcessType_Invalid;
|
||||
|
||||
PRUintn gCurrentDatabaseIndex = BAD_TLS_INDEX;
|
||||
|
||||
PRInt32 gIndexedDBQuota = DEFAULT_QUOTA;
|
||||
@ -357,12 +364,7 @@ CreateDatabaseConnection(const nsACString& aASCIIOrigin,
|
||||
aDatabaseFilePath.Truncate();
|
||||
|
||||
nsCOMPtr<nsIFile> dbDirectory;
|
||||
nsresult rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR,
|
||||
getter_AddRefs(dbDirectory));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = dbDirectory->Append(NS_LITERAL_STRING("indexedDB"));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsresult rv = IDBFactory::GetDirectory(getter_AddRefs(dbDirectory));
|
||||
|
||||
PRBool exists;
|
||||
rv = dbDirectory->Exists(&exists);
|
||||
@ -509,6 +511,11 @@ CreateDatabaseConnection(const nsACString& aASCIIOrigin,
|
||||
|
||||
} // anonyomous namespace
|
||||
|
||||
IDBFactory::IDBFactory()
|
||||
{
|
||||
IDBFactory::NoteUsedByProcessType(XRE_GetProcessType());
|
||||
}
|
||||
|
||||
// static
|
||||
already_AddRefed<nsIIDBFactory>
|
||||
IDBFactory::Create(nsPIDOMWindow* aWindow)
|
||||
@ -620,17 +627,45 @@ IDBFactory::GetIndexedDBQuota()
|
||||
return PRUint32(PR_MAX(gIndexedDBQuota, 0));
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
IDBFactory::NoteUsedByProcessType(GeckoProcessType aProcessType)
|
||||
{
|
||||
if (gAllowedProcessType == GeckoProcessType_Invalid) {
|
||||
gAllowedProcessType = aProcessType;
|
||||
} else if (aProcessType != gAllowedProcessType) {
|
||||
NS_RUNTIMEABORT("More than one process type is accessing IndexedDB!");
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
nsresult
|
||||
IDBFactory::GetDirectory(nsIFile** aDirectory)
|
||||
{
|
||||
nsresult rv;
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Default) {
|
||||
rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, aDirectory);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = (*aDirectory)->Append(NS_LITERAL_STRING("indexedDB"));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
} else {
|
||||
nsCOMPtr<nsILocalFile> localDirectory =
|
||||
do_CreateInstance(NS_LOCAL_FILE_CONTRACTID);
|
||||
rv = localDirectory->InitWithPath(
|
||||
ContentChild::GetSingleton()->GetIndexedDBPath());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
localDirectory.forget((nsILocalFile**)aDirectory);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// static
|
||||
nsresult
|
||||
IDBFactory::GetDirectoryForOrigin(const nsACString& aASCIIOrigin,
|
||||
nsIFile** aDirectory)
|
||||
{
|
||||
nsCOMPtr<nsIFile> directory;
|
||||
nsresult rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR,
|
||||
getter_AddRefs(directory));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = directory->Append(NS_LITERAL_STRING("indexedDB"));
|
||||
nsresult rv = GetDirectory(getter_AddRefs(directory));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
NS_ConvertASCIItoUTF16 originSanitized(aASCIIOrigin);
|
||||
@ -820,6 +855,14 @@ IDBFactory::Open(const nsAString& aName,
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Content) {
|
||||
// Force ContentChild to cache the path from the parent, so that
|
||||
// we do not end up in a side thread that asks for the path (which
|
||||
// would make ContentChild try to send a message in a thread other
|
||||
// than the main one).
|
||||
ContentChild::GetSingleton()->GetIndexedDBPath();
|
||||
}
|
||||
|
||||
if (aName.IsEmpty()) {
|
||||
return NS_ERROR_DOM_INDEXEDDB_NON_TRANSIENT_ERR;
|
||||
}
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "nsIIDBFactory.h"
|
||||
|
||||
#include "nsIWeakReferenceUtils.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
class nsPIDOMWindow;
|
||||
|
||||
@ -73,6 +74,16 @@ public:
|
||||
static PRUint32
|
||||
GetIndexedDBQuota();
|
||||
|
||||
// Called when a process uses an IndexedDB factory. We only allow
|
||||
// a single process type to use IndexedDB - the chrome/single process
|
||||
// in Firefox, and the child process in Fennec - so access by more
|
||||
// than one process type is a very serious error.
|
||||
static void
|
||||
NoteUsedByProcessType(GeckoProcessType aProcessType);
|
||||
|
||||
static nsresult
|
||||
GetDirectory(nsIFile** aDirectory);
|
||||
|
||||
static nsresult
|
||||
GetDirectoryForOrigin(const nsACString& aASCIIOrigin,
|
||||
nsIFile** aDirectory);
|
||||
@ -89,7 +100,7 @@ public:
|
||||
ObjectStoreInfoArray& aObjectStores);
|
||||
|
||||
private:
|
||||
IDBFactory() { }
|
||||
IDBFactory();
|
||||
~IDBFactory() { }
|
||||
|
||||
nsCOMPtr<nsIWeakReference> mWindow;
|
||||
|
@ -118,4 +118,6 @@ ifdef ENABLE_TESTS
|
||||
DIRS += test
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
include $(topsrcdir)/ipc/chromium/chromium-config.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
@ -77,10 +77,6 @@ interface nsIDOMLinkStyle;
|
||||
interface nsIDOMStyleSheet;
|
||||
interface nsIDOMMediaList;
|
||||
|
||||
// Views
|
||||
interface nsIDOMAbstractView;
|
||||
interface nsIDOMDocumentView;
|
||||
|
||||
// Base
|
||||
interface nsIDOMWindow;
|
||||
interface nsIDOMWindowInternal;
|
||||
@ -130,4 +126,3 @@ interface nsIDOMRange;
|
||||
interface nsIDOMCRMFObject;
|
||||
interface nsIDOMCrypto;
|
||||
interface nsIDOMPkcs11;
|
||||
|
||||
|
@ -47,11 +47,10 @@ interface nsISelection;
|
||||
* contain child windows if the document in the window contains a
|
||||
* HTML frameset document or if the document contains iframe elements.
|
||||
*
|
||||
* This interface is not officially defined by any standard bodies, it
|
||||
* originates from the defacto DOM Level 0 standard.
|
||||
* @see <http://www.whatwg.org/html/#window>
|
||||
*/
|
||||
|
||||
[scriptable, uuid(a6cf906b-15b3-11d2-932e-00805f8add32)]
|
||||
[scriptable, uuid(ff7d278f-93db-4078-b89a-058c8e1270b4)]
|
||||
interface nsIDOMWindow : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -150,4 +149,10 @@ interface nsIDOMWindow : nsISupports
|
||||
* Method for sizing this window to the content in the window.
|
||||
*/
|
||||
void sizeToContent();
|
||||
|
||||
/**
|
||||
* @see <http://dev.w3.org/csswg/cssom/#dom-window-getcomputedstyle>
|
||||
*/
|
||||
nsIDOMCSSStyleDeclaration getComputedStyle(in nsIDOMElement elt,
|
||||
[optional] in DOMString pseudoElt);
|
||||
};
|
||||
|
@ -40,7 +40,7 @@
|
||||
interface nsIDOMOfflineResourceList;
|
||||
interface nsIDOMBlob;
|
||||
|
||||
[scriptable, uuid(efff0d88-3b94-4375-bdeb-676a847ecd7d)]
|
||||
[scriptable, uuid(e2796e00-14de-4ce0-acfe-0374bc0e715d)]
|
||||
interface nsIDOMWindow2 : nsIDOMWindow
|
||||
{
|
||||
/**
|
||||
|
@ -46,7 +46,7 @@ interface nsIVariant;
|
||||
interface nsIAnimationFrameListener;
|
||||
interface nsIDOMMediaQueryList;
|
||||
|
||||
[scriptable, uuid(04eafa93-efbe-4254-9d65-91c344fa7ff2)]
|
||||
[scriptable, uuid(4d95736f-8130-43cb-a276-5bc554eca80a)]
|
||||
interface nsIDOMWindowInternal : nsIDOMWindow2
|
||||
{
|
||||
readonly attribute nsIDOMWindowInternal window;
|
||||
|
@ -52,7 +52,7 @@
|
||||
* http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html
|
||||
*/
|
||||
|
||||
[scriptable, uuid(2d305b95-a030-4d24-a12c-7fabf61a8c3c)]
|
||||
[scriptable, uuid(d12f0ecf-434a-4b5c-81ad-354e3b9037b9)]
|
||||
interface nsIDOMDocument : nsIDOMNode
|
||||
{
|
||||
readonly attribute nsIDOMDocumentType doctype;
|
||||
@ -108,4 +108,11 @@ interface nsIDOMDocument : nsIDOMNode
|
||||
raises(DOMException);
|
||||
// Introduced in DOM Level 3:
|
||||
void normalizeDocument();
|
||||
|
||||
/**
|
||||
* The window associated with this document.
|
||||
*
|
||||
* @see http://www.whatwg.org/html/#dom-document-defaultview
|
||||
*/
|
||||
readonly attribute nsIDOMWindow defaultView;
|
||||
};
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
#include "nsIDOMDocument.idl"
|
||||
|
||||
[scriptable, uuid(f493687c-ea80-471b-965b-11467ebea24b)]
|
||||
[scriptable, uuid(68e4448c-eb64-48ea-801a-0c83008d2607)]
|
||||
interface nsIDOMXMLDocument : nsIDOMDocument
|
||||
{
|
||||
// DOM Level 3 Load & Save, DocumentLS
|
||||
|
@ -71,7 +71,6 @@ XPIDLSRCS = \
|
||||
nsIDOMDocumentCSS.idl \
|
||||
nsIDOMRGBColor.idl \
|
||||
nsIDOMRect.idl \
|
||||
nsIDOMViewCSS.idl \
|
||||
nsIDOMNSRGBAColor.idl \
|
||||
$(NULL)
|
||||
|
||||
|
@ -1,49 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Johnny Stenback <jst@netscape.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIDOMAbstractView.idl"
|
||||
|
||||
[scriptable, uuid(0b9341f3-95d4-4fa4-adcd-e119e0db2889)]
|
||||
interface nsIDOMViewCSS : nsIDOMAbstractView
|
||||
{
|
||||
/**
|
||||
* @see <http://dev.w3.org/csswg/cssom/#dom-window-getcomputedstyle>
|
||||
*/
|
||||
nsIDOMCSSStyleDeclaration getComputedStyle(in nsIDOMElement elt,
|
||||
[optional] in DOMString pseudoElt);
|
||||
};
|
@ -82,7 +82,7 @@ XPIDLSRCS = \
|
||||
nsIDOMSimpleGestureEvent.idl \
|
||||
nsIDOMNSMouseEvent.idl \
|
||||
nsIDOMMozTouchEvent.idl \
|
||||
nsIDOMOrientationEvent.idl \
|
||||
nsIDOMDeviceOrientationEvent.idl \
|
||||
nsIDOMScrollAreaEvent.idl \
|
||||
nsIDOMTransitionEvent.idl \
|
||||
nsIDOMPopStateEvent.idl \
|
||||
|
76
dom/interfaces/events/nsIDOMDeviceOrientationEvent.idl
Normal file
76
dom/interfaces/events/nsIDOMDeviceOrientationEvent.idl
Normal file
@ -0,0 +1,76 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIDOMEvent.idl"
|
||||
|
||||
[scriptable, uuid(daf2d570-0ecc-4aa0-aba4-26f60dfcba6a)]
|
||||
interface nsIDOMDeviceOrientationEvent : nsIDOMEvent
|
||||
{
|
||||
void initDeviceOrientationEvent(in DOMString eventTypeArg,
|
||||
in boolean canBubbleArg,
|
||||
in boolean cancelableArg,
|
||||
in double alpha,
|
||||
in double beta,
|
||||
in double gamma,
|
||||
in boolean absolute);
|
||||
|
||||
/*
|
||||
* W3C specification values: http://dev.w3.org/geo/api/spec-source-orientation.html
|
||||
*
|
||||
* Alpha, beta and gamma are Tait-Bryan angles (Z-X'-Y''), that is they correspond to
|
||||
* yaw, pitch and roll in flight coordinates. More specifically, assume the device
|
||||
* is resting face up on a flat surface (its screen is pointing straight up). Then
|
||||
* the X axis points to the right when looking at the screen, the Y axis points up
|
||||
* when looking at the screen, and the Z axis points toward you when looking at
|
||||
* the screen. Alpha/beta/gamma then define the device's orientation by applying
|
||||
* the following rotations to the device in order:
|
||||
*
|
||||
* 1) Rotate it by alpha degrees around its Z axis (like a compass, or like changing
|
||||
* the yaw of an aircraft, assuming the Y axis is the nose of the craft); alpha
|
||||
* is in [0,360).
|
||||
* 2) Rotate it by beta degrees around its X axis (tilting the top of the device
|
||||
* towards or away from you, like pitching an aircraft); beta is in [-180,180).
|
||||
* 3) Rotate it by gamma degrees around its Y axis (tilting it sideways, like
|
||||
* rolling an aircraft); gamma is in [-90,90).
|
||||
*/
|
||||
|
||||
readonly attribute double alpha;
|
||||
readonly attribute double beta;
|
||||
readonly attribute double gamma;
|
||||
readonly attribute boolean absolute;
|
||||
readonly attribute boolean compassCalibrated;
|
||||
};
|
||||
|
@ -38,10 +38,9 @@
|
||||
#include "domstubs.idl"
|
||||
#include "nsIDOMMouseEvent.idl"
|
||||
|
||||
interface nsIDOMAbstractView;
|
||||
interface nsIDOMDataTransfer;
|
||||
|
||||
[scriptable, uuid(98351627-62d7-4b07-bbf3-78009b20764b)]
|
||||
[scriptable, uuid(0f4fef03-c0e9-406c-a754-c01148e431ae)]
|
||||
interface nsIDOMDragEvent : nsIDOMMouseEvent
|
||||
{
|
||||
readonly attribute nsIDOMDataTransfer dataTransfer;
|
||||
@ -49,7 +48,7 @@ interface nsIDOMDragEvent : nsIDOMMouseEvent
|
||||
void initDragEvent(in DOMString typeArg,
|
||||
in boolean canBubbleArg,
|
||||
in boolean cancelableArg,
|
||||
in nsIDOMAbstractView aView,
|
||||
in nsIDOMWindow aView,
|
||||
in long aDetail,
|
||||
in long aScreenX,
|
||||
in long aScreenY,
|
||||
|
@ -39,7 +39,7 @@
|
||||
|
||||
#include "nsIDOMUIEvent.idl"
|
||||
|
||||
[scriptable, uuid(028e0e6e-8b01-11d3-aae7-0010838a3123)]
|
||||
[scriptable, uuid(e44d7977-20f2-442e-bc13-0f2f52992a4c)]
|
||||
interface nsIDOMKeyEvent : nsIDOMUIEvent
|
||||
{
|
||||
const unsigned long DOM_VK_CANCEL = 0x03;
|
||||
@ -193,7 +193,7 @@ interface nsIDOMKeyEvent : nsIDOMUIEvent
|
||||
void initKeyEvent(in DOMString typeArg,
|
||||
in boolean canBubbleArg,
|
||||
in boolean cancelableArg,
|
||||
in nsIDOMAbstractView viewArg,
|
||||
in nsIDOMWindow viewArg,
|
||||
in boolean ctrlKeyArg,
|
||||
in boolean altKeyArg,
|
||||
in boolean shiftKeyArg,
|
||||
|
@ -47,7 +47,7 @@
|
||||
* http://www.w3.org/TR/DOM-Level-2-Events/
|
||||
*/
|
||||
|
||||
[scriptable, uuid(ff751edc-8b02-aae7-0010-8301838a3123)]
|
||||
[scriptable, uuid(73558605-f479-493e-86d1-9794cd117fef)]
|
||||
interface nsIDOMMouseEvent : nsIDOMUIEvent
|
||||
{
|
||||
readonly attribute long screenX;
|
||||
@ -67,7 +67,7 @@ interface nsIDOMMouseEvent : nsIDOMUIEvent
|
||||
void initMouseEvent(in DOMString typeArg,
|
||||
in boolean canBubbleArg,
|
||||
in boolean cancelableArg,
|
||||
in nsIDOMAbstractView viewArg,
|
||||
in nsIDOMWindow viewArg,
|
||||
in long detailArg,
|
||||
in long screenXArg,
|
||||
in long screenYArg,
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
#include "nsIDOMMouseEvent.idl"
|
||||
|
||||
[scriptable, uuid(ba8d1a7e-b475-4542-8d32-01e7ea7b8091)]
|
||||
[scriptable, uuid(af08bce0-6821-4bac-8964-0fcee4be549a)]
|
||||
interface nsIDOMMouseScrollEvent : nsIDOMMouseEvent
|
||||
{
|
||||
const long HORIZONTAL_AXIS = 1;
|
||||
@ -49,7 +49,7 @@ interface nsIDOMMouseScrollEvent : nsIDOMMouseEvent
|
||||
void initMouseScrollEvent(in DOMString typeArg,
|
||||
in boolean canBubbleArg,
|
||||
in boolean cancelableArg,
|
||||
in nsIDOMAbstractView viewArg,
|
||||
in nsIDOMWindow viewArg,
|
||||
in long detailArg,
|
||||
in long screenXArg,
|
||||
in long screenYArg,
|
||||
|
@ -40,7 +40,7 @@
|
||||
#include "nsIDOMMouseEvent.idl"
|
||||
|
||||
|
||||
[scriptable, uuid(9b454391-0190-4313-a070-1e26e9bf6f31)]
|
||||
[scriptable, uuid(e9ed248b-1995-482f-8407-33ae7744bb9c)]
|
||||
interface nsIDOMMozTouchEvent : nsIDOMMouseEvent
|
||||
{
|
||||
readonly attribute unsigned long streamId;
|
||||
@ -48,7 +48,7 @@ interface nsIDOMMozTouchEvent : nsIDOMMouseEvent
|
||||
void initMozTouchEvent(in DOMString typeArg,
|
||||
in boolean canBubbleArg,
|
||||
in boolean cancelableArg,
|
||||
in nsIDOMAbstractView viewArg,
|
||||
in nsIDOMWindow viewArg,
|
||||
in long detailArg,
|
||||
in long screenXArg,
|
||||
in long screenYArg,
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user