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

Unified Diff: gpu/ipc/service/gpu_channel.cc

Issue 2601993002: Remove base::ScopedPtrHashMap from gpu/ipc/service/. (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « gpu/ipc/service/gpu_channel.h ('k') | gpu/ipc/service/gpu_channel_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/ipc/service/gpu_channel.cc
diff --git a/gpu/ipc/service/gpu_channel.cc b/gpu/ipc/service/gpu_channel.cc
index 8ed788a38174e3cf06d81a61d7c6181fe5a81986..4a99a6db4b61768d87a49d4c5452f94f12d56ad1 100644
--- a/gpu/ipc/service/gpu_channel.cc
+++ b/gpu/ipc/service/gpu_channel.cc
@@ -701,7 +701,11 @@ void GpuChannel::OnStreamRescheduled(int32_t stream_id, bool scheduled) {
}
GpuCommandBufferStub* GpuChannel::LookupCommandBuffer(int32_t route_id) {
- return stubs_.get(route_id);
+ auto it = stubs_.find(route_id);
+ if (it == stubs_.end())
+ return nullptr;
+
+ return it->second.get();
}
void GpuChannel::LoseAllContexts() {
@@ -772,7 +776,7 @@ void GpuChannel::HandleMessage(
const IPC::Message& msg = channel_msg->message;
int32_t routing_id = msg.routing_id();
- GpuCommandBufferStub* stub = stubs_.get(routing_id);
+ GpuCommandBufferStub* stub = LookupCommandBuffer(routing_id);
DCHECK(!stub || stub->IsScheduled());
@@ -873,7 +877,7 @@ void GpuChannel::RemoveRouteFromStream(int32_t route_id) {
#if defined(OS_ANDROID)
const GpuCommandBufferStub* GpuChannel::GetOneStub() const {
for (const auto& kv : stubs_) {
- const GpuCommandBufferStub* stub = kv.second;
+ const GpuCommandBufferStub* stub = kv.second.get();
if (stub->decoder() && !stub->decoder()->WasContextLost())
return stub;
}
@@ -896,7 +900,7 @@ void GpuChannel::OnCreateCommandBuffer(
if (stub) {
*result = true;
*capabilities = stub->decoder()->GetCapabilities();
- stubs_.set(route_id, std::move(stub));
+ stubs_[route_id] = std::move(stub);
Ken Russell (switch to Gerrit) 2016/12/29 05:41:15 I confirmed that forgetting the std::move here is
Avi (use Gerrit) 2016/12/29 15:18:02 Acknowledged.
} else {
*result = false;
*capabilities = gpu::Capabilities();
@@ -915,7 +919,7 @@ std::unique_ptr<GpuCommandBufferStub> GpuChannel::CreateCommandBuffer(
}
int32_t share_group_id = init_params.share_group_id;
- GpuCommandBufferStub* share_group = stubs_.get(share_group_id);
+ GpuCommandBufferStub* share_group = LookupCommandBuffer(share_group_id);
if (!share_group && share_group_id != MSG_ROUTING_NONE) {
DLOG(ERROR)
@@ -977,7 +981,12 @@ void GpuChannel::OnDestroyCommandBuffer(int32_t route_id) {
TRACE_EVENT1("gpu", "GpuChannel::OnDestroyCommandBuffer",
"route_id", route_id);
- std::unique_ptr<GpuCommandBufferStub> stub = stubs_.take_and_erase(route_id);
+ std::unique_ptr<GpuCommandBufferStub> stub;
+ auto it = stubs_.find(route_id);
+ if (it != stubs_.end()) {
+ stub = std::move(it->second);
+ stubs_.erase(it);
+ }
// In case the renderer is currently blocked waiting for a sync reply from the
// stub, we need to make sure to reschedule the correct stream here.
if (stub && !stub->IsScheduled()) {
« no previous file with comments | « gpu/ipc/service/gpu_channel.h ('k') | gpu/ipc/service/gpu_channel_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698