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

Unified Diff: content/common/gpu/client/context_provider_command_buffer.cc

Issue 1900993002: Move SharedMemoryLimits out of WebGraphicsContext3DCommandBufferImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@limits
Patch Set: move-limits: types Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: content/common/gpu/client/context_provider_command_buffer.cc
diff --git a/content/common/gpu/client/context_provider_command_buffer.cc b/content/common/gpu/client/context_provider_command_buffer.cc
index e1712f5b97d0550dd12c304e188e32c1585cb437..204287f27b0d0d09e292782cf1294cfd97231963 100644
--- a/content/common/gpu/client/context_provider_command_buffer.cc
+++ b/content/common/gpu/client/context_provider_command_buffer.cc
@@ -40,8 +40,10 @@ class ContextProviderCommandBuffer::LostContextCallbackProxy
ContextProviderCommandBuffer::ContextProviderCommandBuffer(
std::unique_ptr<WebGraphicsContext3DCommandBufferImpl> context3d,
+ const gpu::SharedMemoryLimits& memory_limits,
CommandBufferContextType type)
: context3d_(std::move(context3d)),
+ memory_limits_(memory_limits),
context_type_(type),
debug_name_(CommandBufferContextTypeToString(type)) {
DCHECK(main_thread_checker_.CalledOnValidThread());
@@ -81,11 +83,9 @@ bool ContextProviderCommandBuffer::BindToCurrentThread() {
return true;
context3d_->SetContextType(context_type_);
- if (!context3d_->InitializeOnCurrentThread())
+ if (!context3d_->InitializeOnCurrentThread(memory_limits_))
return false;
- InitializeCapabilities();
-
std::string unique_context_name =
base::StringPrintf("%s-%p", debug_name_.c_str(), context3d_.get());
context3d_->GetGLInterface()->TraceBeginCHROMIUM("gpu_toplevel",
@@ -146,12 +146,10 @@ base::Lock* ContextProviderCommandBuffer::GetLock() {
return &context_lock_;
}
-cc::ContextProvider::Capabilities
-ContextProviderCommandBuffer::ContextCapabilities() {
+gpu::Capabilities ContextProviderCommandBuffer::ContextCapabilities() {
DCHECK(lost_context_callback_proxy_); // Is bound to thread.
DCHECK(context_thread_checker_.CalledOnValidThread());
-
- return capabilities_;
+ return context3d_->GetImplementation()->capabilities();
}
void ContextProviderCommandBuffer::DeleteCachedResources() {
@@ -170,18 +168,6 @@ void ContextProviderCommandBuffer::OnLostContext() {
gr_context_->OnLostContext();
}
-void ContextProviderCommandBuffer::InitializeCapabilities() {
- Capabilities caps;
- caps.gpu = context3d_->GetImplementation()->capabilities();
-
- size_t mapped_memory_limit = context3d_->GetMappedMemoryLimit();
- caps.max_transfer_buffer_usage_bytes =
- mapped_memory_limit == WebGraphicsContext3DCommandBufferImpl::kNoLimit
- ? std::numeric_limits<size_t>::max() : mapped_memory_limit;
-
- capabilities_ = caps;
-}
-
void ContextProviderCommandBuffer::SetLostContextCallback(
const LostContextCallback& lost_context_callback) {
DCHECK(context_thread_checker_.CalledOnValidThread());

Powered by Google App Engine
This is Rietveld 408576698