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

Unified Diff: gpu/command_buffer/service/buffer_manager.h

Issue 2469803003: Revert of Initialize buffers before allowing access to them. (Closed)
Patch Set: Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/service/buffer_manager.h
diff --git a/gpu/command_buffer/service/buffer_manager.h b/gpu/command_buffer/service/buffer_manager.h
index 845824c56679ceaf6cfce6d27ddd8a8e5cc34a9f..bb69e7dfe0c2f2603a82f662b039868c4f0a0de4 100644
--- a/gpu/command_buffer/service/buffer_manager.h
+++ b/gpu/command_buffer/service/buffer_manager.h
@@ -78,8 +78,9 @@
// Check if an offset, size range is valid for the current buffer.
bool CheckRange(GLintptr offset, GLsizeiptr size) const;
- // Sets a range of this buffer's shadowed data.
- void SetRange(GLintptr offset, GLsizeiptr size, const GLvoid * data);
+ // Sets a range of this buffer's shadowed data. Returns false if offset/size
+ // is out of range.
+ bool SetRange(GLintptr offset, GLsizeiptr size, const GLvoid * data);
bool IsDeleted() const {
return deleted_;
@@ -95,8 +96,15 @@
void SetMappedRange(GLintptr offset, GLsizeiptr size, GLenum access,
void* pointer, scoped_refptr<gpu::Buffer> shm,
- unsigned int shm_offset);
- void RemoveMappedRange();
+ unsigned int shm_offset) {
+ mapped_range_.reset(
+ new MappedRange(offset, size, access, pointer, shm, shm_offset));
+ }
+
+ void RemoveMappedRange() {
+ mapped_range_.reset(nullptr);
+ }
+
const MappedRange* GetMappedRange() const {
return mapped_range_.get();
}
@@ -298,30 +306,6 @@
bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
base::trace_event::ProcessMemoryDump* pmd) override;
- // Validate if a buffer is bound at target, if it's unmapped, if it's
- // large enough. Return the buffer bound to |target| if access is granted;
- // return nullptr if a GL error is generated.
- Buffer* RequestBufferAccess(ContextState* context_state,
- GLenum target,
- GLintptr offset,
- GLsizeiptr size,
- const char* func_name);
- // Same as above, but assume to access the entire buffer.
- Buffer* RequestBufferAccess(ContextState* context_state,
- GLenum target,
- const char* func_name);
- // Same as above, but it can be any buffer rather than the buffer bound to
- // |target|. Return true if access is granted; return false if a GL error is
- // generated.
- bool RequestBufferAccess(ErrorState* error_state,
- Buffer* buffer,
- const char* func_name,
- const char* message_tag);
-
- uint32_t mapped_buffer_count() const {
- return mapped_buffer_count_;
- }
-
private:
friend class Buffer;
friend class TestHelper; // Needs access to DoBufferData.
@@ -334,6 +318,7 @@
// Does a glBufferSubData and updates the appropriate accounting.
// Assumes the values have already been validated.
void DoBufferSubData(
+ ErrorState* error_state,
Buffer* buffer,
GLenum target,
GLintptr offset,
@@ -372,9 +357,6 @@
GLenum usage,
bool use_shadow);
- void IncreaseMappedBufferCount();
- void DecreaseMappedBufferCount();
-
std::unique_ptr<MemoryTypeTracker> memory_type_tracker_;
MemoryTracker* memory_tracker_;
scoped_refptr<FeatureInfo> feature_info_;
@@ -401,10 +383,6 @@
bool lost_context_;
bool use_client_side_arrays_for_stream_buffers_;
- // Keep track of total mapped buffer count. In most use cases it should be 0,
- // so we could bypass checking each individual buffer as an optimization.
- uint32_t mapped_buffer_count_;
-
DISALLOW_COPY_AND_ASSIGN(BufferManager);
};
« no previous file with comments | « content/test/gpu/gpu_tests/webgl_conformance_expectations.py ('k') | gpu/command_buffer/service/buffer_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698