1. A method for executing a web application, comprising: loading the web application in a web browser; loading a native code module associated with the web application into a secure runtime environment; writing a set of rendering commands to a command buffer using the native code module; reading the rendering commands from the command buffer using a trusted code module; and rendering an image for use by the web application by executing the rendering commands read by the trusted code module using a rendering engine and a graphics-processing unit (GPU).