Chrome 94 Beta: WebCodecs, WebGPU, Scheduling, and More
2021-08-27 04:06:00 Author: www.blogger.com(查看原文) 阅读量:33 收藏

tag:blogger.com,1999:blog-2471378914199150966.post-11013666221289812562021-08-26T12:06:00.000-07:002021-08-26T12:06:27.083-07:00Chrome 94 Beta: WebCodecs, WebGPU, Scheduling, and More<p>Unless otherwise noted, changes described below apply to the newest Chrome beta channel release for Android, Chrome OS, Linux, macOS, and Windows. Learn more about the features listed here through the provided links or from the list on <a href="https://www.chromestatus.com/features#milestone%3D76">ChromeStatus.com</a>. Chrome 94 is beta as of August 26, 2021.</p> <h2>WebCodecs</h2><p>Existing media APIs (<code><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement">HTMLMediaElement</a></code>, <a href="https://developer.mozilla.org/en-US/docs/Web/API/Media_Source_Extensions_API">Media Source Extensions</a>, <code><a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API">WebAudio</a></code>, <code><a href="https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder">MediaRecorder</a></code>, and <a href="https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API">WebRTC</a>) are high-level and narrowly-focused. A low-level codec API would better support emerging applications, such as latency-sensitive game streaming, client-side effects or transcoding, and polyfillable media container support, without the increased network and CPU cost of JavaScript or WebAssembly codec implementations. </p> <p>The WebCodecs API eliminates these deficiencies by giving programmers a way to use media components that are already present in the browser. Specifically:<br /></p><ul><li>Video and audio decoders</li><li>Video and audio encoders</li><li>Raw video frames</li><li>Image decoders</li></ul> <p>This feature has also completed its origin trial in Chrome 93 and is now available by default. For more information, see <a href="https://web.dev/webcodecs/">Video processing with WebCodecs</a>. </p> <h2>WebGPU</h2><p>The WebGPU API is the successor to the WebGL and WebGL2 graphics APIs for the Web. It provides modern features such as "GPU compute" as well as lower overhead access to GPU hardware and better, more predictable performance. This is an improvement over the existing WebGL interfaces, which were designed for drawing images but could only be repurposed for other kinds of computations with great effort.</p> <p>WebGPU exposes modern computer graphics capabilities, specifically Direct3D 12, Metal, and Vulkan, for performing rendering and computation operations on a graphics processing unit (GPU). Advantages of WebGPU over earlier technologies include:</p> <ul><li>Separating resource management, work preparation, and submission to the GPU.</li><li>Pipeline states that function similarly to OS APIs.</li><li>Binding groups that allow graphics drivers to perform needed preparations in advance of rendering.</li></ul> <p>This feature is starting an origin trial in Chrome 94 with the hope of shipping in Chrome 99. For more information, see <a href="https://web.dev/gpu/">Access modern GPU features with WebGPU</a>.</p> <h2>Scheduling APIs: Prioritized scheduler.postTask()</h2><p>It's difficult to build web apps that are responsive to user interaction and that remain responsive over time. Scripts are one of the primary culprits hurting responsiveness. Consider a "search-as-you-type" feature: an app with this capability needs to keep up with the user's typing at the same time that it is fetching and displaying results. This doesn't take into account anything happening on the page such as animation, which must be rendered smoothly.</p> <p>The problem is usually tackled by chunking and scheduling main thread work, specifically executing work asynchronously at appropriate times. This approach has its own problems, including the fact that whatever priority the developer sets, it's still competing for time on the main thread, which doesn't recognize the developer's prioritization, and is also responsible for browser tasks such as <code>fetch()</code> operations and garbage collection. </p> <p>The <a href="https://www.chromestatus.com/feature/6031161734201344"><code>scheduler.postTask()</code> method</a> fixes these scheduling dilemmas by letting developers schedule tasks (JavaScript callbacks) with an OS browser scheduler at three levels of priority: user-blocking, user-visible, and background. It also exposes a <code>TaskController</code> interface, which can dynamically cancel tasks and change their priority. </p> <p>This feature completed its origin trial in Chrome 93 and is now available by default in Chrome. For a list of other new and completed origin trials, see the Origin Trials section below.</p> <h2>Origin Trials</h2><p>In addition to the items above, this version of Chrome introduces the origin trials described below. Origin trials allow you to try new features and give feedback on usability, practicality, and effectiveness to the web standards community. To register for any of the origin trials currently supported in Chrome, including the ones described below, visit the <a href="https://developers.chrome.com/origintrials/#/trials/active">Chrome Origin Trials dashboard</a>. To learn more about origin trials in Chrome, visit the <a href="https://web.dev/origin-trials/">Origin Trials Guide for Web Developers</a>. Microsoft Edge runs its own origin trials separate from Chrome. To learn more, see the <a href="https://developer.microsoft.com/en-us/microsoft-edge/origin-trials/">Microsoft Edge Origin Trials Developer Console</a>. </p> <h3>New Origin Trials</h3> <h4>Early Hints for Navigation</h4><p>Chrome is testing <a href="https://developer.chrome.com/origintrials/#/view_trial/2856408063659737089">a new HTTP status code</a>: 103 Early Hints for preloading subresources earlier. <br />When a 103 response includes <code>&lt;link rel=preload&gt;</code> or other link headers Chromium tries to preload (and/or preconnect, prefetch) specified resources before the final response is received. This gives web developers a way to optimize apps, sites, and pages.</p> <h3>Completed Origin Trials</h3><p>The following features, previously in a Chrome origin trial, are now enabled by default.</p> <h4>Canvas Color Management</h4><p>This update <a href="https://www.chromestatus.com/feature/5807007661555712">formalizes that the default color space</a> for <code><a href="https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D">CanvasRenderingContext2D</a></code> objects and <code><a href="https://developer.mozilla.org/en-US/docs/Web/API/ImageData">ImageData</a></code> objects is sRGB. This clarifies that the <code>CanvasRenderingContext2D</code> interface is fully color managed (that all inputs are converted to the canvas color space). These were previously conventions and not clearly specified. This updates makes the following changes:</p> <ul><li>Adds parameters to specify a non-sRGB color space when creating a <code>CanvasRenderingContext2D</code> object or an <code>ImageData</code> object.</li><li>Adds support for the Display P3 color space for these parameters.</li></ul> <p>Content displayed by <code>CanvasRenderingContext2D</code> is currently limited to the sRGB color space, which is less than the capabilities of modern displays and cameras. This feature allows creating a <code>CanvasRenderingContext2D</code> object that is in the Display P3 color space. This also clears up several points of ambiguity about the color behavior of <code>CanvasRenderingContext2D</code>.</p> <h4>VirtualKeyboard API</h4><p>The <code>VirtualKeyboard</code> interface has methods and properties to <a href="https://www.chromestatus.com/feature/5680057076940800">control when a virtual keyboard is shown or hidden</a>. It also fires events with the size of the virtual keyboard when it occludes content in the page. The virtual keyboard is the on-screen keyboard used for input in scenarios where a hardware keyboard may not be available. </p> <p>Unlike a hardware keyboard, a virtual keyboard can adapt its shape to optimize for the expected input. Developers have control over the displayed shape of the virtual keyboard through the <code>inputmode</code> attribute, but have limited control over when the virtual keyboard is shown or hidden.</p> <h2>Other features in this release</h2> <h3>CSS</h3> <h4>Align transform-style: preserve-3d and perspective Property with the Spec</h4><p><a href="https://www.chromestatus.com/feature/5640541339385856">The transform-style: preserve-3d and perspective properties now align with the spec</a>. The preserve-3d property allows child elements to participate in the parent's 3D scene, and the perspective property applies a perspective transform to child elements. Before this change, Chromium applied both of these effects based on the containing block hierarchy rather than the DOM tree, and allowed them to extend through elements without transform-related properties on them.</p> <h4>flex-basis Honors Keywords 'content' and 'min/max/fit-content'</h4><p><a href="https://www.chromestatus.com/feature/5635933158244352">Chrome now supports</a> the keywords <code>content</code>, <code>min-content</code>, <code>max-content</code>, and <code>fit-content</code> as values for the <code>flex-basis</code> property and its <code>flex</code> shorthand. The <code>content</code> keyword makes flex base size use the default sizing rules as if <code>flex-basis</code> and preferred size property (<code>width</code> or <code>height</code>) are both <code>auto</code>, ignoring any specified <code>width</code> or <code>height</code> in the main axis dimension when <code>flex-basis</code> is <code>auto</code>. The other keywords are the same as usual and give more options for specifying the flex base size.</p> <p>In responsive layouts, when adding or removing <code>display:flex</code> to a container, you previously had to sometimes add/remove values for each individual item. <code>content</code> eliminates the need in some situations.</p> <h4>scrollbar-gutter</h4><p>The <a href="https://www.chromestatus.com/feature/5746559209701376"><code>scrollbar-gutter</code> property</a> provides control over the presence of scrollbar gutters (the space reserved to display a scrollbar), allowing developers to prevent layout changes as content expands while avoiding unwanted visuals when scrolling isn't needed.<br /><br />Note that the presence of the scrollbars themselves is determined by the <code>overflow</code> property. The choice of classical or overlay scrollbars is up to the user agent. This property provides developers with more control over how their layouts interact with the scrollbars provided by the browser.</p> <h3>MediaStreamTrack Insertable Streams (a.k.a. Breakout Box)</h3><p>This API lets developers <a href="https://web.dev/mediastreamtrack-insertable-media-processing/">manipulate raw media carried by <code>MediaStreamTracks</code></a> such as the output of cameras, microphones, screen captures or the decoder part of a codec and the input to the decoder part of a codec. It uses WebCodecs interfaces to represent raw media frames and exposes them using streams, similar to the way the WebRTC Insertable Streams exposes encoded data from <a href="https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/RTCPeerConnection">RTCPeerConnections</a>. Example use cases include <a href="https://www.w3.org/TR/webrtc-nv-use-cases/#funnyhats*">funny hats</a> and <a href="https://www.w3.org/TR/webrtc-nv-use-cases/#machinelearning*">real-time object identification and annotation</a>.</p> <h3>Return Fixed Lists for navigator.plugins and navigator.mimeTypes</h3><p>With the removal of Flash, there is no longer a need to return anything for <code>navigator.plugins</code> and <code>navigator.mimeTypes</code>. These APIs were used primarily for:</p> <ul> <li>Probing for Flash player support</li> <li>Fingerprinting. </li> </ul> <p>Some sites use these APIs to probe for PDF viewer support. With this change, <a href="https://www.chromestatus.com/feature/5741884322349056">these arrays will return fixed lists</a> containing a standard list of PDF viewer plugins.</p> <p>Note that this is not the removal or change of any API, it is merely the return of fixed arrays for these two existing APIs.</p> <h2>JavaScript</h2><p>This version of Chrome incorporates version 9.4 of the V8 JavaScript engine. It specifically includes the change listed below. You can find a complete <a href="https://v8.dev/blog">list of recent features</a> in the V8 release notes.</p> <h3>Self Profiling API</h3><p>Chrome now supports <a href="https://www.chromestatus.com/feature/5170190448852992">a web-exposed sampling profiler</a> for measuring client JavaScript execution time. Gathering JavaScript profiles from real users can help developers debug slow observed performance without invasive manual instrumentation.</p> <h2>Deprecations, and Removals</h2><p>This version of Chrome introduces the deprecations and removals listed below. Visit ChromeStatus.com for lists of <a href="https://www.chromestatus.com/features#browsers.chrome.status%3A%22Deprecated%22">current deprecations</a> and <a href="https://www.chromestatus.com/features#browsers.chrome.status:%22Removed%22">previous removals</a>.</p> <h3>Deprecate and Remove WebSQL in Third-Party Contexts</h3><p><a href="https://www.chromestatus.com/feature/5684870116278272">WebSQL in third-party contexts is now deprecated</a>. Removal is expected in Chrome 97. The Web SQL Database standard was first proposed in April 2009 and abandoned in November 2010. Gecko never implemented this feature and WebKit deprecated in in 2019. The W3C encourages <a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API">Web Storage</a> and <a href="https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API">Indexed Database</a> for those needing alternatives.</p> <p>Developers should expect that WebSQL itself will be deprecated and removed when usage is low enough.</p> <h3>Restrict Private Network Requests for Subresources to Secure Contexts</h3><p>Private network requests for subresources <a href="https://developer.chrome.com/blog/private-network-access-update/">may now only be initiated from a secure context</a>. Private network requests are those initiated from a public network, targeting a private network. Examples include internet to <em>intranet</em> requests and intranet loopbacks. </p> <p>This is a first step towards fully implementing <a href="https://wicg.github.io/private-network-access/">Private Network Access</a>. Servers running inside local networks, or on a user's device, expose powerful capabilities to the web in ways that can be quite dangerous. Private Network Access proposes a set of changes to limit the impact of requests to these servers by ensuring that the servers are opting-into any communication with external entities.</p> <p>For this opt-in to have any meaning, the servers need to be able to ensure that the client origin is authenticated. To that end, only secure contexts are empowered to make external requests.</p>Chromium Bloghttps://draft.blogger.com/profile/06394244468194711527[email protected]

文章来源: http://www.blogger.com/feeds/2471378914199150966/posts/default/1101366622128981256
如有侵权请联系:admin#unsafe.sh