OLD | NEW |
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2012 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 | 5 |
6 /** @file hello_world_gles.cc | 6 /** @file hello_world_gles.cc |
7 * This example demonstrates loading and running a simple 3D openGL ES 2.0 | 7 * This example demonstrates loading and running a simple 3D openGL ES 2.0 |
8 * application. | 8 * application. |
9 */ | 9 */ |
10 | 10 |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 | 388 |
389 // If we can't preallocate the buffer because the size is unknown, then | 389 // If we can't preallocate the buffer because the size is unknown, then |
390 // fail the load. | 390 // fail the load. |
391 if (total == -1) { | 391 if (total == -1) { |
392 req->cb_(NULL); | 392 req->cb_(NULL); |
393 FreeRequest(req); | 393 FreeRequest(req); |
394 return; | 394 return; |
395 } | 395 } |
396 | 396 |
397 // Otherwise allocate a buffer with enough space for a terminating | 397 // Otherwise allocate a buffer with enough space for a terminating |
398 // NUL in case we need one. | 398 // NULL in case we need one. |
399 cnt = (total > LONG_MAX) ? LONG_MAX : (int32_t) total; | 399 cnt = (total > LONG_MAX) ? LONG_MAX : (int32_t) total; |
400 req->buf_ = (char *) malloc(cnt + 1); | 400 req->buf_ = (char *) malloc(cnt + 1); |
401 req->buf_[cnt] = 0; | 401 req->buf_[cnt] = 0; |
402 req->size_ = cnt; | 402 req->size_ = cnt; |
403 int32_t bytes = ppb_urlloader_interface->ReadResponseBody(req->loader_, | 403 int32_t bytes = ppb_urlloader_interface->ReadResponseBody(req->loader_, |
404 req->buf_, cnt, PP_MakeCompletionCallback(URLPartialRead, req)); | 404 req->buf_, cnt, PP_MakeCompletionCallback(URLPartialRead, req)); |
405 | 405 |
406 // Usually we are pending. | 406 // Usually we are pending. |
407 if (bytes == PP_OK_COMPLETIONPENDING) return; | 407 if (bytes == PP_OK_COMPLETIONPENDING) return; |
408 | 408 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 } | 604 } |
605 return NULL; | 605 return NULL; |
606 } | 606 } |
607 | 607 |
608 | 608 |
609 /** | 609 /** |
610 * Called before the plugin module is unloaded. | 610 * Called before the plugin module is unloaded. |
611 */ | 611 */ |
612 PP_EXPORT void PPP_ShutdownModule() { | 612 PP_EXPORT void PPP_ShutdownModule() { |
613 } | 613 } |
OLD | NEW |