summaryrefslogtreecommitdiffstats
path: root/dom/canvas/DrawTargetWebgl.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--dom/canvas/DrawTargetWebgl.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/dom/canvas/DrawTargetWebgl.cpp b/dom/canvas/DrawTargetWebgl.cpp
index eae6dd78f3..fdc45cc842 100644
--- a/dom/canvas/DrawTargetWebgl.cpp
+++ b/dom/canvas/DrawTargetWebgl.cpp
@@ -21,6 +21,7 @@
#include "mozilla/gfx/Swizzle.h"
#include "mozilla/layers/ImageDataSerializer.h"
#include "mozilla/layers/RemoteTextureMap.h"
+#include "mozilla/widget/ScreenManager.h"
#include "skia/include/core/SkPixmap.h"
#include "nsContentUtils.h"
@@ -325,6 +326,11 @@ void SharedContextWebgl::UnlinkGlyphCaches() {
void SharedContextWebgl::OnMemoryPressure() { mShouldClearCaches = true; }
+void SharedContextWebgl::ClearCaches() {
+ OnMemoryPressure();
+ ClearCachesIfNecessary();
+}
+
// Clear out the entire list of texture handles from any source.
void SharedContextWebgl::ClearAllTextures() {
while (!mTextureHandles.isEmpty()) {
@@ -852,10 +858,14 @@ bool DrawTargetWebgl::CanCreate(const IntSize& aSize, SurfaceFormat aFormat) {
// In addition, allow acceleration up to this size even if the screen is
// smaller. A lot content expects this size to work well. See Bug 999841
static const int32_t kScreenPixels = 980 * 480;
- IntSize screenSize = gfxPlatform::GetPlatform()->GetScreenSize();
- if (aSize.width * aSize.height >
- std::max(screenSize.width * screenSize.height, kScreenPixels)) {
- return false;
+
+ if (RefPtr<widget::Screen> screen =
+ widget::ScreenManager::GetSingleton().GetPrimaryScreen()) {
+ LayoutDeviceIntSize screenSize = screen->GetRect().Size();
+ if (aSize.width * aSize.height >
+ std::max(screenSize.width * screenSize.height, kScreenPixels)) {
+ return false;
+ }
}
}