OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 define([ | 5 define([ |
6 'console', | 6 'console', |
7 'monotonic_clock', | 7 'monotonic_clock', |
8 'timer', | 8 'timer', |
9 'mojo/public/bindings/js/connector', | 9 'mojo/public/bindings/js/connection', |
10 'mojo/bindings/js/core', | 10 'mojo/bindings/js/core', |
11 'mojo/apps/js/bindings/gl', | 11 'mojo/apps/js/bindings/gl', |
12 'mojo/apps/js/bindings/threading', | 12 'mojo/apps/js/bindings/threading', |
13 'mojo/services/native_viewport/native_viewport.mojom', | 13 'mojo/services/native_viewport/native_viewport.mojom', |
14 'mojo/public/shell/shell.mojom', | 14 'mojo/public/shell/shell.mojom', |
15 ], function(console, | 15 ], function(console, |
16 monotonicClock, | 16 monotonicClock, |
17 timer, | 17 timer, |
18 connector, | 18 connection, |
19 core, | 19 core, |
20 gljs, | 20 gljs, |
21 threading, | 21 threading, |
22 nativeViewport, | 22 nativeViewport, |
23 shell) { | 23 shell) { |
24 | 24 |
25 const VERTEX_SHADER_SOURCE = [ | 25 const VERTEX_SHADER_SOURCE = [ |
26 'uniform mat4 u_mvpMatrix;', | 26 'uniform mat4 u_mvpMatrix;', |
27 'attribute vec4 a_position;', | 27 'attribute vec4 a_position;', |
28 'void main()', | 28 'void main()', |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, 0); | 274 gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, 0); |
275 | 275 |
276 return cubeIndices.length; | 276 return cubeIndices.length; |
277 } | 277 } |
278 | 278 |
279 function SampleApp(shell) { | 279 function SampleApp(shell) { |
280 this.shell_ = shell; | 280 this.shell_ = shell; |
281 | 281 |
282 var pipe = new core.createMessagePipe(); | 282 var pipe = new core.createMessagePipe(); |
283 this.shell_.connect('mojo:mojo_native_viewport_service', pipe.handle1); | 283 this.shell_.connect('mojo:mojo_native_viewport_service', pipe.handle1); |
284 new connector.Connection(pipe.handle0, NativeViewportClientImpl, | 284 new connection.Connection(pipe.handle0, NativeViewportClientImpl, |
285 nativeViewport.NativeViewportProxy); | 285 nativeViewport.NativeViewportProxy); |
286 } | 286 } |
287 // TODO(aa): It is a bummer to need this stub object in JavaScript. We should | 287 // TODO(aa): It is a bummer to need this stub object in JavaScript. We should |
288 // have a 'client' object that contains both the sending and receiving bits of | 288 // have a 'client' object that contains both the sending and receiving bits of |
289 // the client side of the interface. Since JS is loosely typed, we do not need | 289 // the client side of the interface. Since JS is loosely typed, we do not need |
290 // a separate base class to inherit from to receive callbacks. | 290 // a separate base class to inherit from to receive callbacks. |
291 SampleApp.prototype = Object.create(shell.ShellClientStub.prototype); | 291 SampleApp.prototype = Object.create(shell.ShellClientStub.prototype); |
292 | 292 |
293 | 293 |
294 function NativeViewportClientImpl(remote) { | 294 function NativeViewportClientImpl(remote) { |
295 this.remote_ = remote; | 295 this.remote_ = remote; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 GLES2ClientImpl.prototype.getRotationForTimeDelta = function(secondsDelta) { | 383 GLES2ClientImpl.prototype.getRotationForTimeDelta = function(secondsDelta) { |
384 return secondsDelta * 40; | 384 return secondsDelta * 40; |
385 }; | 385 }; |
386 | 386 |
387 GLES2ClientImpl.prototype.contextLost = function() { | 387 GLES2ClientImpl.prototype.contextLost = function() { |
388 console.log('GLES2ClientImpl.prototype.contextLost'); | 388 console.log('GLES2ClientImpl.prototype.contextLost'); |
389 }; | 389 }; |
390 | 390 |
391 | 391 |
392 return function(handle) { | 392 return function(handle) { |
393 new connector.Connection(handle, SampleApp, shell.ShellProxy); | 393 new connection.Connection(handle, SampleApp, shell.ShellProxy); |
394 }; | 394 }; |
395 }); | 395 }); |
OLD | NEW |