Commit 97a781d9 authored by kainino's avatar kainino Committed by Commit bot

Migrate WebGL timers to TaskRunnerTimer

This migrates the WebGL task timers dispatchContextLostEventTimer and restoreTimer to TaskRunnerTimer and correctly puts them in the WebGL task source.

BUG=624694
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2668573002
Cr-Commit-Position: refs/heads/master@{#447951}
parent 928bd40b
...@@ -32,6 +32,7 @@ RefPtr<WebTaskRunner> TaskRunnerHelper::get(TaskType type, LocalFrame* frame) { ...@@ -32,6 +32,7 @@ RefPtr<WebTaskRunner> TaskRunnerHelper::get(TaskType type, LocalFrame* frame) {
case TaskType::Presentation: case TaskType::Presentation:
case TaskType::Sensor: case TaskType::Sensor:
case TaskType::PerformanceTimeline: case TaskType::PerformanceTimeline:
case TaskType::WebGL:
case TaskType::Timer: case TaskType::Timer:
case TaskType::UnspecedTimer: case TaskType::UnspecedTimer:
case TaskType::MiscPlatformAPI: case TaskType::MiscPlatformAPI:
......
...@@ -98,6 +98,10 @@ enum class TaskType : unsigned { ...@@ -98,6 +98,10 @@ enum class TaskType : unsigned {
// https://w3c.github.io/performance-timeline/#performance-timeline // https://w3c.github.io/performance-timeline/#performance-timeline
PerformanceTimeline, PerformanceTimeline,
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15
// This task source is used for all tasks in the WebGL spec.
WebGL,
// Use MiscPlatformAPI for a task that is defined in the spec but is not yet // Use MiscPlatformAPI for a task that is defined in the spec but is not yet
// associated with any specific task runner in the spec. MiscPlatformAPI is // associated with any specific task runner in the spec. MiscPlatformAPI is
// not encouraged for stable and matured APIs. The spec should define the task // not encouraged for stable and matured APIs. The spec should define the task
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "core/dom/DOMArrayBuffer.h" #include "core/dom/DOMArrayBuffer.h"
#include "core/dom/DOMTypedArray.h" #include "core/dom/DOMTypedArray.h"
#include "core/dom/FlexibleArrayBufferView.h" #include "core/dom/FlexibleArrayBufferView.h"
#include "core/dom/TaskRunnerHelper.h"
#include "core/frame/ImageBitmap.h" #include "core/frame/ImageBitmap.h"
#include "core/frame/LocalFrame.h" #include "core/frame/LocalFrame.h"
#include "core/frame/Settings.h" #include "core/frame/Settings.h"
...@@ -1039,26 +1040,32 @@ WebGLRenderingContextBase::WebGLRenderingContextBase( ...@@ -1039,26 +1040,32 @@ WebGLRenderingContextBase::WebGLRenderingContextBase(
std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, std::unique_ptr<WebGraphicsContext3DProvider> contextProvider,
const CanvasContextCreationAttributes& requestedAttributes, const CanvasContextCreationAttributes& requestedAttributes,
unsigned version) unsigned version)
: WebGLRenderingContextBase(nullptr, : WebGLRenderingContextBase(
passedOffscreenCanvas, nullptr,
std::move(contextProvider), passedOffscreenCanvas,
requestedAttributes, TaskRunnerHelper::get(TaskType::WebGL,
version) {} passedOffscreenCanvas->getExecutionContext()),
std::move(contextProvider),
requestedAttributes,
version) {}
WebGLRenderingContextBase::WebGLRenderingContextBase( WebGLRenderingContextBase::WebGLRenderingContextBase(
HTMLCanvasElement* passedCanvas, HTMLCanvasElement* passedCanvas,
std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, std::unique_ptr<WebGraphicsContext3DProvider> contextProvider,
const CanvasContextCreationAttributes& requestedAttributes, const CanvasContextCreationAttributes& requestedAttributes,
unsigned version) unsigned version)
: WebGLRenderingContextBase(passedCanvas, : WebGLRenderingContextBase(
nullptr, passedCanvas,
std::move(contextProvider), nullptr,
requestedAttributes, TaskRunnerHelper::get(TaskType::WebGL, &passedCanvas->document()),
version) {} std::move(contextProvider),
requestedAttributes,
version) {}
WebGLRenderingContextBase::WebGLRenderingContextBase( WebGLRenderingContextBase::WebGLRenderingContextBase(
HTMLCanvasElement* passedCanvas, HTMLCanvasElement* passedCanvas,
OffscreenCanvas* passedOffscreenCanvas, OffscreenCanvas* passedOffscreenCanvas,
RefPtr<WebTaskRunner> taskRunner,
std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, std::unique_ptr<WebGraphicsContext3DProvider> contextProvider,
const CanvasContextCreationAttributes& requestedAttributes, const CanvasContextCreationAttributes& requestedAttributes,
unsigned version) unsigned version)
...@@ -1070,10 +1077,13 @@ WebGLRenderingContextBase::WebGLRenderingContextBase( ...@@ -1070,10 +1077,13 @@ WebGLRenderingContextBase::WebGLRenderingContextBase(
m_contextLostMode(NotLostContext), m_contextLostMode(NotLostContext),
m_autoRecoveryMethod(Manual), m_autoRecoveryMethod(Manual),
m_dispatchContextLostEventTimer( m_dispatchContextLostEventTimer(
taskRunner,
this, this,
&WebGLRenderingContextBase::dispatchContextLostEvent), &WebGLRenderingContextBase::dispatchContextLostEvent),
m_restoreAllowed(false), m_restoreAllowed(false),
m_restoreTimer(this, &WebGLRenderingContextBase::maybeRestoreContext), m_restoreTimer(taskRunner,
this,
&WebGLRenderingContextBase::maybeRestoreContext),
m_boundArrayBuffer(this, nullptr), m_boundArrayBuffer(this, nullptr),
m_boundVertexArrayObject(this, nullptr), m_boundVertexArrayObject(this, nullptr),
m_currentProgram(this, nullptr), m_currentProgram(this, nullptr),
......
...@@ -691,9 +691,9 @@ class MODULES_EXPORT WebGLRenderingContextBase : public CanvasRenderingContext, ...@@ -691,9 +691,9 @@ class MODULES_EXPORT WebGLRenderingContextBase : public CanvasRenderingContext,
// real ones, it's likely that there's no JavaScript on the stack, but that // real ones, it's likely that there's no JavaScript on the stack, but that
// might be dependent on how exactly the platform discovers that the context // might be dependent on how exactly the platform discovers that the context
// was lost. For better portability we always defer the dispatch of the event. // was lost. For better portability we always defer the dispatch of the event.
Timer<WebGLRenderingContextBase> m_dispatchContextLostEventTimer; TaskRunnerTimer<WebGLRenderingContextBase> m_dispatchContextLostEventTimer;
bool m_restoreAllowed; bool m_restoreAllowed;
Timer<WebGLRenderingContextBase> m_restoreTimer; TaskRunnerTimer<WebGLRenderingContextBase> m_restoreTimer;
bool m_markedCanvasDirty; bool m_markedCanvasDirty;
...@@ -1636,6 +1636,7 @@ class MODULES_EXPORT WebGLRenderingContextBase : public CanvasRenderingContext, ...@@ -1636,6 +1636,7 @@ class MODULES_EXPORT WebGLRenderingContextBase : public CanvasRenderingContext,
private: private:
WebGLRenderingContextBase(HTMLCanvasElement*, WebGLRenderingContextBase(HTMLCanvasElement*,
OffscreenCanvas*, OffscreenCanvas*,
RefPtr<WebTaskRunner>,
std::unique_ptr<WebGraphicsContext3DProvider>, std::unique_ptr<WebGraphicsContext3DProvider>,
const CanvasContextCreationAttributes&, const CanvasContextCreationAttributes&,
unsigned); unsigned);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment