diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2017-08-16 09:45:13 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-16 09:45:13 -0500 |
commit | 4d10d39e8fe841c5fe2ac58da2daaa13c10c140e (patch) | |
tree | f77d68b734a6327898cc8c01505b0723bf45ed4a /components/canvas/webgl_mode | |
parent | ee94e2b7c0bd327abe8f9545b2a1f792f67a2bdd (diff) | |
parent | cfe22e3979b7270833a4b450b25fb2157deb1da2 (diff) | |
download | servo-4d10d39e8fe841c5fe2ac58da2daaa13c10c140e.tar.gz servo-4d10d39e8fe841c5fe2ac58da2daaa13c10c140e.zip |
Auto merge of #18114 - emilio:revert-webgl-refactor, r=nox
Revert "Auto merge of #17891 - MortimerGoro:webgl_move, r=glennw,emilio"
This reverts commit 90f55ea4580e2a15f7d70d0491444f18b972d450, reversing
changes made to 2e60b27a2186a8cba4b952960155dfcf3f47d7db.
Doing that per Josh's request, since it's causing very frequent intermittent OOMs on the android builders.
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18114)
<!-- Reviewable:end -->
Diffstat (limited to 'components/canvas/webgl_mode')
-rw-r--r-- | components/canvas/webgl_mode/inprocess.rs | 95 | ||||
-rw-r--r-- | components/canvas/webgl_mode/mod.rs | 6 |
2 files changed, 0 insertions, 101 deletions
diff --git a/components/canvas/webgl_mode/inprocess.rs b/components/canvas/webgl_mode/inprocess.rs deleted file mode 100644 index 257f1395545..00000000000 --- a/components/canvas/webgl_mode/inprocess.rs +++ /dev/null @@ -1,95 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -use ::gl_context::GLContextFactory; -use ::webgl_thread::{WebGLExternalImageApi, WebGLExternalImageHandler, WebGLThreadObserver, WebGLThread}; -use canvas_traits::webgl::{WebGLChan, WebGLContextId, WebGLMsg, WebGLPipeline, WebGLReceiver}; -use canvas_traits::webgl::{WebGLSender, WebVRCommand, WebVRRenderHandler}; -use canvas_traits::webgl::webgl_channel; -use euclid::Size2D; -use std::marker::PhantomData; -use webrender; -use webrender_api; - -/// WebGL Threading API entry point that lives in the constellation. -pub struct WebGLThreads(WebGLSender<WebGLMsg>); - -impl WebGLThreads { - /// Creates a new WebGLThreads object - pub fn new(gl_factory: GLContextFactory, - webrender_api_sender: webrender_api::RenderApiSender, - webvr_compositor: Option<Box<WebVRRenderHandler>>) - -> (WebGLThreads, Box<webrender::ExternalImageHandler>) { - // This implementation creates a single `WebGLThread` for all the pipelines. - let channel = WebGLThread::start(gl_factory, - webrender_api_sender, - webvr_compositor.map(|c| WebVRRenderWrapper(c)), - PhantomData); - let external = WebGLExternalImageHandler::new(WebGLExternalImages::new(channel.clone())); - (WebGLThreads(channel), Box::new(external)) - } - - /// Gets the WebGLThread handle for each script pipeline. - pub fn pipeline(&self) -> WebGLPipeline { - // This mode creates a single thread, so the existing WebGLChan is just cloned. - WebGLPipeline(WebGLChan(self.0.clone())) - } - - /// Sends a exit message to close the WebGLThreads and release all WebGLContexts. - pub fn exit(&self) -> Result<(), &'static str> { - self.0.send(WebGLMsg::Exit).map_err(|_| "Failed to send Exit message") - } -} - -/// Bridge between the webrender::ExternalImage callbacks and the WebGLThreads. -struct WebGLExternalImages { - webgl_channel: WebGLSender<WebGLMsg>, - // Used to avoid creating a new channel on each received WebRender request. - lock_channel: (WebGLSender<(u32, Size2D<i32>)>, WebGLReceiver<(u32, Size2D<i32>)>), -} - -impl WebGLExternalImages { - fn new(channel: WebGLSender<WebGLMsg>) -> Self { - Self { - webgl_channel: channel, - lock_channel: webgl_channel().unwrap(), - } - } -} - -impl WebGLExternalImageApi for WebGLExternalImages { - fn lock(&mut self, ctx_id: WebGLContextId) -> (u32, Size2D<i32>) { - self.webgl_channel.send(WebGLMsg::Lock(ctx_id, self.lock_channel.0.clone())).unwrap(); - self.lock_channel.1.recv().unwrap() - } - - fn unlock(&mut self, ctx_id: WebGLContextId) { - self.webgl_channel.send(WebGLMsg::Unlock(ctx_id)).unwrap(); - } -} - -/// Custom observer used in a `WebGLThread`. -impl WebGLThreadObserver for PhantomData<()> { - fn on_context_create(&mut self, ctx_id: WebGLContextId, texture_id: u32, size: Size2D<i32>) { - debug!("WebGLContext created (ctx_id: {:?} texture_id: {:?} size: {:?}", ctx_id, texture_id, size); - } - - fn on_context_resize(&mut self, ctx_id: WebGLContextId, texture_id: u32, size: Size2D<i32>) { - debug!("WebGLContext resized (ctx_id: {:?} texture_id: {:?} size: {:?}", ctx_id, texture_id, size); - } - - fn on_context_delete(&mut self, ctx_id: WebGLContextId) { - debug!("WebGLContext deleted (ctx_id: {:?})", ctx_id); - } -} - - -/// Wrapper to send WebVR commands used in `WebGLThread`. -struct WebVRRenderWrapper(Box<WebVRRenderHandler>); - -impl WebVRRenderHandler for WebVRRenderWrapper { - fn handle(&mut self, command: WebVRCommand, texture: Option<(u32, Size2D<i32>)>) { - self.0.handle(command, texture); - } -} diff --git a/components/canvas/webgl_mode/mod.rs b/components/canvas/webgl_mode/mod.rs deleted file mode 100644 index 660818fb096..00000000000 --- a/components/canvas/webgl_mode/mod.rs +++ /dev/null @@ -1,6 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -mod inprocess; -pub use self::inprocess::WebGLThreads; |