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

Side by Side Diff: content/browser/gpu/gpu_process_host_ui_shim.cc

Issue 16431010: Refactor RenderProcessHost to use IPC::Listener instead of RenderWidgetHost (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase on top of hash_pair move. Created 7 years, 6 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
OLDNEW
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 "content/browser/gpu/gpu_process_host_ui_shim.h" 5 #include "content/browser/gpu/gpu_process_host_ui_shim.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 }; 83 };
84 84
85 RenderWidgetHostViewPort* GetRenderWidgetHostViewFromSurfaceID( 85 RenderWidgetHostViewPort* GetRenderWidgetHostViewFromSurfaceID(
86 int surface_id) { 86 int surface_id) {
87 int render_process_id = 0; 87 int render_process_id = 0;
88 int render_widget_id = 0; 88 int render_widget_id = 0;
89 if (!GpuSurfaceTracker::Get()->GetRenderWidgetIDForSurface( 89 if (!GpuSurfaceTracker::Get()->GetRenderWidgetIDForSurface(
90 surface_id, &render_process_id, &render_widget_id)) 90 surface_id, &render_process_id, &render_widget_id))
91 return NULL; 91 return NULL;
92 92
93 RenderProcessHost* process = RenderProcessHost::FromID(render_process_id); 93 RenderWidgetHost* host =
94 if (!process) 94 RenderWidgetHost::FromID(render_process_id, render_widget_id);
95 return NULL;
96
97 RenderWidgetHost* host = process->GetRenderWidgetHostByID(render_widget_id);
98 return host ? RenderWidgetHostViewPort::FromRWHV(host->GetView()) : NULL; 95 return host ? RenderWidgetHostViewPort::FromRWHV(host->GetView()) : NULL;
99 } 96 }
100 97
101 } // namespace 98 } // namespace
102 99
103 void RouteToGpuProcessHostUIShimTask(int host_id, const IPC::Message& msg) { 100 void RouteToGpuProcessHostUIShimTask(int host_id, const IPC::Message& msg) {
104 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(host_id); 101 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(host_id);
105 if (ui_shim) 102 if (ui_shim)
106 ui_shim->OnMessageReceived(msg); 103 ui_shim->OnMessageReceived(msg);
107 } 104 }
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 void GpuProcessHostUIShim::OnUpdateVSyncParameters(int surface_id, 221 void GpuProcessHostUIShim::OnUpdateVSyncParameters(int surface_id,
225 base::TimeTicks timebase, 222 base::TimeTicks timebase,
226 base::TimeDelta interval) { 223 base::TimeDelta interval) {
227 224
228 int render_process_id = 0; 225 int render_process_id = 0;
229 int render_widget_id = 0; 226 int render_widget_id = 0;
230 if (!GpuSurfaceTracker::Get()->GetRenderWidgetIDForSurface( 227 if (!GpuSurfaceTracker::Get()->GetRenderWidgetIDForSurface(
231 surface_id, &render_process_id, &render_widget_id)) { 228 surface_id, &render_process_id, &render_widget_id)) {
232 return; 229 return;
233 } 230 }
234 RenderProcessHost* host = RenderProcessHost::FromID(render_process_id); 231 RenderWidgetHost* rwh =
235 if (!host) 232 RenderWidgetHost::FromID(render_process_id, render_widget_id);
236 return;
237 RenderWidgetHost* rwh = host->GetRenderWidgetHostByID(render_widget_id);
238 if (!rwh) 233 if (!rwh)
239 return; 234 return;
240 RenderWidgetHostImpl::From(rwh)->UpdateVSyncParameters(timebase, interval); 235 RenderWidgetHostImpl::From(rwh)->UpdateVSyncParameters(timebase, interval);
241 } 236 }
242 237
243 void GpuProcessHostUIShim::OnLogMessage( 238 void GpuProcessHostUIShim::OnLogMessage(
244 int level, 239 int level,
245 const std::string& header, 240 const std::string& header,
246 const std::string& message) { 241 const std::string& message) {
247 GpuDataManagerImpl::GetInstance()->AddLogMessage( 242 GpuDataManagerImpl::GetInstance()->AddLogMessage(
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 view->AcceleratedSurfaceRelease(); 391 view->AcceleratedSurfaceRelease();
397 } 392 }
398 393
399 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( 394 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived(
400 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { 395 const GPUVideoMemoryUsageStats& video_memory_usage_stats) {
401 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( 396 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats(
402 video_memory_usage_stats); 397 video_memory_usage_stats);
403 } 398 }
404 399
405 } // namespace content 400 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_process_host.cc ('k') | content/browser/renderer_host/media/web_contents_video_capture_device.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698