OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
12 * | 12 * |
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY |
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR |
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #include "webkit/tools/pepper_test_plugin/plugin_object.h" | 26 #include "webkit/tools/pepper_test_plugin/plugin_object.h" |
27 | 27 |
| 28 #include <stdio.h> |
28 #include <cmath> | 29 #include <cmath> |
29 #include <limits> | 30 #include <limits> |
30 #include <stdio.h> | |
31 #include <string> | 31 #include <string> |
32 | 32 |
33 #if defined(INDEPENDENT_PLUGIN) | 33 #if defined(INDEPENDENT_PLUGIN) |
34 #define CHECK(x) | 34 #define CHECK(x) |
35 #else | 35 #else |
36 #include "base/logging.h" | 36 #include "base/logging.h" |
37 #include "gpu/command_buffer/client/gles2_lib.h" | 37 #include "gpu/command_buffer/client/gles2_lib.h" |
38 #include "gpu/command_buffer/client/gles2_demo_cc.h" | 38 #include "gpu/command_buffer/client/gles2_demo_cc.h" |
39 #include "third_party/skia/include/core/SkBitmap.h" | 39 #include "third_party/skia/include/core/SkBitmap.h" |
40 #include "third_party/skia/include/core/SkCanvas.h" | 40 #include "third_party/skia/include/core/SkCanvas.h" |
41 #include "third_party/skia/include/effects/SkGradientShader.h" | 41 #include "third_party/skia/include/effects/SkGradientShader.h" |
42 #endif | 42 #endif |
43 #include "webkit/tools/pepper_test_plugin/event_handler.h" | 43 #include "webkit/tools/pepper_test_plugin/event_handler.h" |
44 #include "webkit/tools/pepper_test_plugin/test_object.h" | 44 #include "webkit/tools/pepper_test_plugin/test_object.h" |
45 | 45 |
46 NPNetscapeFuncs* browser; | 46 NPNetscapeFuncs* browser; |
47 | 47 |
48 namespace { | 48 namespace { |
49 | 49 |
50 // Properties ------------------------------------------------------------------ | 50 // Properties ------------------------------------------------------------------ |
51 | 51 |
52 enum { | 52 enum { |
53 ID_PROPERTY_PROPERTY = 0, | 53 ID_PROPERTY_PROPERTY = 0, |
54 ID_PROPERTY_TEST_OBJECT, | 54 ID_PROPERTY_TEST_OBJECT, |
55 NUM_PROPERTY_IDENTIFIERS | 55 NUM_PROPERTY_IDENTIFIERS |
56 }; | 56 }; |
57 | 57 |
58 static NPIdentifier plugin_property_identifiers[NUM_PROPERTY_IDENTIFIERS]; | 58 static NPIdentifier plugin_property_identifiers[NUM_PROPERTY_IDENTIFIERS]; |
59 static const NPUTF8* plugin_property_identifier_names[NUM_PROPERTY_IDENTIFIERS]
= { | 59 static const NPUTF8* |
| 60 plugin_property_identifier_names[NUM_PROPERTY_IDENTIFIERS] = { |
60 "property", | 61 "property", |
61 "testObject", | 62 "testObject", |
62 }; | 63 }; |
63 | 64 |
64 // Methods --------------------------------------------------------------------- | 65 // Methods --------------------------------------------------------------------- |
65 | 66 |
66 enum { | 67 enum { |
67 ID_TEST_GET_PROPERTY = 0, | 68 ID_TEST_GET_PROPERTY = 0, |
68 ID_SET_TEXT_BOX, | 69 ID_SET_TEXT_BOX, |
69 NUM_METHOD_IDENTIFIERS | 70 NUM_METHOD_IDENTIFIERS |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 helper_->Flush(); | 394 helper_->Flush(); |
394 gles2::g_gl_impl = NULL; | 395 gles2::g_gl_impl = NULL; |
395 | 396 |
396 // Schedule another call to Draw. | 397 // Schedule another call to Draw. |
397 browser->pluginthreadasynccall(npp_, Draw3DCallback, this); | 398 browser->pluginthreadasynccall(npp_, Draw3DCallback, this); |
398 #endif | 399 #endif |
399 } | 400 } |
400 | 401 |
401 bool PluginObject::InitializeCommandBuffer() { | 402 bool PluginObject::InitializeCommandBuffer() { |
402 #if !defined(INDEPENDENT_PLUGIN) | 403 #if !defined(INDEPENDENT_PLUGIN) |
403 const static int32 kCommandBufferSize = 512 * 1024; | 404 static const int32 kCommandBufferSize = 512 * 1024; |
404 command_buffer_.reset(new CommandBufferPepper(npp_, browser)); | 405 command_buffer_.reset(new CommandBufferPepper(npp_, browser)); |
405 if (command_buffer_->Initialize(kCommandBufferSize)) { | 406 if (command_buffer_->Initialize(kCommandBufferSize)) { |
406 helper_.reset(new gpu::gles2::GLES2CmdHelper(command_buffer_.get())); | 407 helper_.reset(new gpu::gles2::GLES2CmdHelper(command_buffer_.get())); |
407 if (helper_->Initialize()) { | 408 if (helper_->Initialize()) { |
408 | |
409 const int32 kTransferBufferSize = 512 * 1024; | 409 const int32 kTransferBufferSize = 512 * 1024; |
410 int32 transfer_buffer_id = | 410 int32 transfer_buffer_id = |
411 command_buffer_->CreateTransferBuffer(kTransferBufferSize); | 411 command_buffer_->CreateTransferBuffer(kTransferBufferSize); |
412 gpu::Buffer transfer_buffer = | 412 gpu::Buffer transfer_buffer = |
413 command_buffer_->GetTransferBuffer(transfer_buffer_id); | 413 command_buffer_->GetTransferBuffer(transfer_buffer_id); |
414 if (transfer_buffer.ptr) { | 414 if (transfer_buffer.ptr) { |
415 gles2_implementation_.reset(new gpu::gles2::GLES2Implementation( | 415 gles2_implementation_.reset(new gpu::gles2::GLES2Implementation( |
416 helper_.get(), | 416 helper_.get(), |
417 transfer_buffer.size, | 417 transfer_buffer.size, |
418 transfer_buffer.ptr, | 418 transfer_buffer.ptr, |
419 transfer_buffer_id)); | 419 transfer_buffer_id)); |
420 return true; | 420 return true; |
421 } | 421 } |
422 } | 422 } |
423 | 423 |
424 helper_.reset(); | 424 helper_.reset(); |
425 } | 425 } |
426 | 426 |
427 command_buffer_.reset(); | 427 command_buffer_.reset(); |
428 #endif | 428 #endif |
429 | 429 |
430 return false; | 430 return false; |
431 } | 431 } |
OLD | NEW |