Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: trunk/src/mojo/apps/js/main.js

Issue 304593002: Revert 272983 "Change Shell / ShellClient to ServiceProvider" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/js/bindings/connection', 9 'mojo/public/js/bindings/connection',
10 'mojo/public/js/bindings/core', 10 'mojo/public/js/bindings/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/interfaces/service_provider/service_provider.mojom', 14 'mojo/public/interfaces/shell/shell.mojom',
15 ], function(console, 15 ], function(console,
16 monotonicClock, 16 monotonicClock,
17 timer, 17 timer,
18 connection, 18 connection,
19 core, 19 core,
20 gljs, 20 gljs,
21 threading, 21 threading,
22 nativeViewport, 22 nativeViewport,
23 service_provider) { 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()',
29 '{', 29 '{',
30 ' gl_Position = u_mvpMatrix * a_position;', 30 ' gl_Position = u_mvpMatrix * a_position;',
31 '}' 31 '}'
32 ].join('\n'); 32 ].join('\n');
33 33
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 gl.bindBuffer(gl.ARRAY_BUFFER, 0); 269 gl.bindBuffer(gl.ARRAY_BUFFER, 0);
270 270
271 vboIndices = gl.createBuffer(); 271 vboIndices = gl.createBuffer();
272 gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, vboIndices); 272 gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, vboIndices);
273 gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, cubeIndices, gl.STATIC_DRAW); 273 gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, cubeIndices, gl.STATIC_DRAW);
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(service_provider) { 279 function SampleApp(shell) {
280 this.service_provider_ = service_provider; 280 this.shell_ = shell;
281 281
282 var pipe = new core.createMessagePipe(); 282 var pipe = new core.createMessagePipe();
283 this.service_provider_.connect('mojo:mojo_native_viewport_service', 283 this.shell_.connect('mojo:mojo_native_viewport_service', pipe.handle1);
284 pipe.handle1);
285 new connection.Connection(pipe.handle0, NativeViewportClientImpl, 284 new connection.Connection(pipe.handle0, NativeViewportClientImpl,
286 nativeViewport.NativeViewportProxy); 285 nativeViewport.NativeViewportProxy);
287 } 286 }
288 // 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
289 // 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
290 // 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
291 // a separate base class to inherit from to receive callbacks. 290 // a separate base class to inherit from to receive callbacks.
292 SampleApp.prototype = 291 SampleApp.prototype = Object.create(shell.ShellClientStub.prototype);
293 Object.create(service_provider.ServiceProviderStub.prototype);
294 292
295 293
296 function NativeViewportClientImpl(remote) { 294 function NativeViewportClientImpl(remote) {
297 this.remote_ = remote; 295 this.remote_ = remote;
298 296
299 var pipe = core.createMessagePipe(); 297 var pipe = core.createMessagePipe();
300 298
301 var rect = new nativeViewport.Rect; 299 var rect = new nativeViewport.Rect;
302 rect.position = new nativeViewport.Point; 300 rect.position = new nativeViewport.Point;
303 rect.size = new nativeViewport.Size; 301 rect.size = new nativeViewport.Size;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 GLES2ClientImpl.prototype.getRotationForTimeDelta = function(secondsDelta) { 383 GLES2ClientImpl.prototype.getRotationForTimeDelta = function(secondsDelta) {
386 return secondsDelta * 40; 384 return secondsDelta * 40;
387 }; 385 };
388 386
389 GLES2ClientImpl.prototype.contextLost = function() { 387 GLES2ClientImpl.prototype.contextLost = function() {
390 console.log('GLES2ClientImpl.prototype.contextLost'); 388 console.log('GLES2ClientImpl.prototype.contextLost');
391 }; 389 };
392 390
393 391
394 return function(handle) { 392 return function(handle) {
395 new connection.Connection( 393 new connection.Connection(handle, SampleApp, shell.ShellProxy);
396 handle, SampleApp, service_provider.ServiceProviderProxy);
397 }; 394 };
398 }); 395 });
OLDNEW
« no previous file with comments | « trunk/src/content/renderer/render_thread_impl.cc ('k') | trunk/src/mojo/dbus/dbus_external_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698