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 #include "gpu/command_buffer/service/common_decoder.h" | 5 #include "gpu/command_buffer/service/common_decoder.h" |
6 #include "gpu/command_buffer/service/cmd_buffer_engine.h" | 6 #include "gpu/command_buffer/service/cmd_buffer_engine.h" |
7 | 7 |
8 namespace gpu { | 8 namespace gpu { |
9 | 9 |
10 CommonDecoder::Bucket::Bucket() : size_(0) {} | 10 CommonDecoder::Bucket::Bucket() : size_(0) {} |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 Buffer buffer = engine_->GetSharedMemoryBuffer(shm_id); | 66 Buffer buffer = engine_->GetSharedMemoryBuffer(shm_id); |
67 if (!buffer.ptr) | 67 if (!buffer.ptr) |
68 return NULL; | 68 return NULL; |
69 unsigned int end = offset + size; | 69 unsigned int end = offset + size; |
70 if (end > buffer.size || end < offset) { | 70 if (end > buffer.size || end < offset) { |
71 return NULL; | 71 return NULL; |
72 } | 72 } |
73 return static_cast<int8*>(buffer.ptr) + offset; | 73 return static_cast<int8*>(buffer.ptr) + offset; |
74 } | 74 } |
75 | 75 |
| 76 Buffer CommonDecoder::GetSharedMemoryBuffer(unsigned int shm_id) { |
| 77 return engine_->GetSharedMemoryBuffer(shm_id); |
| 78 } |
| 79 |
76 bool CommonDecoder::PushAddress(uint32 offset) { | 80 bool CommonDecoder::PushAddress(uint32 offset) { |
77 if (call_stack_.size() < kMaxStackDepth) { | 81 if (call_stack_.size() < kMaxStackDepth) { |
78 CommandAddress return_address(engine_->GetGetOffset()); | 82 CommandAddress return_address(engine_->GetGetOffset()); |
79 if (engine_->SetGetOffset(offset)) { | 83 if (engine_->SetGetOffset(offset)) { |
80 call_stack_.push(return_address); | 84 call_stack_.push(return_address); |
81 return true; | 85 return true; |
82 } | 86 } |
83 } | 87 } |
84 return false; | 88 return false; |
85 } | 89 } |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 } | 343 } |
340 const void* src = bucket->GetData(offset, size); | 344 const void* src = bucket->GetData(offset, size); |
341 if (!src) { | 345 if (!src) { |
342 return error::kInvalidArguments; | 346 return error::kInvalidArguments; |
343 } | 347 } |
344 memcpy(data, src, size); | 348 memcpy(data, src, size); |
345 return error::kNoError; | 349 return error::kNoError; |
346 } | 350 } |
347 | 351 |
348 } // namespace gpu | 352 } // namespace gpu |
OLD | NEW |