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

Side by Side Diff: o3d/gpu_plugin/command_buffer.cc

Issue 196032: Replaced BaseNPObject with DefaultNPObject because...... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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
« no previous file with comments | « o3d/gpu_plugin/command_buffer.h ('k') | o3d/gpu_plugin/command_buffer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #include "o3d/gpu_plugin/command_buffer.h" 5 #include "o3d/gpu_plugin/command_buffer.h"
6 6
7 namespace o3d { 7 namespace o3d {
8 namespace gpu_plugin { 8 namespace gpu_plugin {
9 9
10 CommandBuffer::CommandBuffer(NPP npp) : DispatchedNPObject(npp) { 10 CommandBuffer::CommandBuffer(NPP npp) : npp_(npp) {
11 } 11 }
12 12
13 CommandBuffer::~CommandBuffer() { 13 CommandBuffer::~CommandBuffer() {
14 if (shared_memory_) { 14 if (shared_memory_) {
15 NPBrowser::get()->UnmapSharedMemory(npp(), shared_memory_); 15 NPBrowser::get()->UnmapSharedMemory(npp_, shared_memory_);
16 } 16 }
17 } 17 }
18 18
19 bool CommandBuffer::Initialize(int32 size) { 19 bool CommandBuffer::Initialize(int32 size) {
20 if (buffer_object_.Get()) 20 if (buffer_object_.Get())
21 return false; 21 return false;
22 22
23 NPObjectPointer<NPObject> window = NPObjectPointer<NPObject>::FromReturned( 23 NPObjectPointer<NPObject> window = NPObjectPointer<NPObject>::FromReturned(
24 NPBrowser::get()->GetWindowNPObject(npp())); 24 NPBrowser::get()->GetWindowNPObject(npp_));
25 if (!window.Get()) 25 if (!window.Get())
26 return false; 26 return false;
27 27
28 NPObjectPointer<NPObject> chromium; 28 NPObjectPointer<NPObject> chromium;
29 if (!NPGetProperty(npp(), window, "chromium", &chromium)) { 29 if (!NPGetProperty(npp_, window, "chromium", &chromium)) {
30 return false; 30 return false;
31 } 31 }
32 32
33 NPObjectPointer<NPObject> system; 33 NPObjectPointer<NPObject> system;
34 if (!NPGetProperty(npp(), chromium, "system", &system)) { 34 if (!NPGetProperty(npp_, chromium, "system", &system)) {
35 return false; 35 return false;
36 } 36 }
37 37
38 if (!NPInvoke(npp(), system, "createSharedMemory", size, 38 if (!NPInvoke(npp_, system, "createSharedMemory", size,
39 &buffer_object_)) { 39 &buffer_object_)) {
40 return false; 40 return false;
41 } 41 }
42 42
43 shared_memory_ = NPBrowser::get()->MapSharedMemory( 43 shared_memory_ = NPBrowser::get()->MapSharedMemory(
44 npp(), buffer_object_.Get(), size, false); 44 npp_, buffer_object_.Get(), size, false);
45 if (!shared_memory_) { 45 if (!shared_memory_) {
46 buffer_object_ = NPObjectPointer<NPObject>(); 46 buffer_object_ = NPObjectPointer<NPObject>();
47 return false; 47 return false;
48 } 48 }
49 49
50 return true; 50 return true;
51 } 51 }
52 52
53 NPObjectPointer<NPObject> CommandBuffer::GetBuffer() { 53 NPObjectPointer<NPObject> CommandBuffer::GetBuffer() {
54 return buffer_object_; 54 return buffer_object_;
55 } 55 }
56 56
57 void CommandBuffer::SetPutOffset(int32 offset) { 57 void CommandBuffer::SetPutOffset(int32 offset) {
58 } 58 }
59 59
60 int32 CommandBuffer::GetGetOffset() { 60 int32 CommandBuffer::GetGetOffset() {
61 return 0; 61 return 0;
62 } 62 }
63 63
64 } // namespace gpu_plugin 64 } // namespace gpu_plugin
65 } // namespace o3d 65 } // namespace o3d
OLDNEW
« no previous file with comments | « o3d/gpu_plugin/command_buffer.h ('k') | o3d/gpu_plugin/command_buffer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698