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

Side by Side Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 288343004: working copy of "zero_copy" Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 6 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
« no previous file with comments | « content/browser/gpu/dri_buffer_manager.cc ('k') | content/common/child_process_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Represents the browser side of the browser <--> renderer communication 5 // Represents the browser side of the browser <--> renderer communication
6 // channel. There will be one RenderProcessHost per renderer process. 6 // channel. There will be one RenderProcessHost per renderer process.
7 7
8 #include "content/browser/renderer_host/render_process_host_impl.h" 8 #include "content/browser/renderer_host/render_process_host_impl.h"
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 #include "ui/gfx/win/dpi.h" 170 #include "ui/gfx/win/dpi.h"
171 #endif 171 #endif
172 172
173 #if defined(ENABLE_WEBRTC) 173 #if defined(ENABLE_WEBRTC)
174 #include "content/browser/media/webrtc_internals.h" 174 #include "content/browser/media/webrtc_internals.h"
175 #include "content/browser/renderer_host/media/media_stream_track_metrics_host.h" 175 #include "content/browser/renderer_host/media/media_stream_track_metrics_host.h"
176 #include "content/browser/renderer_host/media/webrtc_identity_service_host.h" 176 #include "content/browser/renderer_host/media/webrtc_identity_service_host.h"
177 #include "content/common/media/media_stream_messages.h" 177 #include "content/common/media/media_stream_messages.h"
178 #endif 178 #endif
179 179
180 #if defined(OS_LINUX)
181 #include "content/browser/gpu/dri_buffer_manager.h"
182 #endif
183
180 extern bool g_exited_main_message_loop; 184 extern bool g_exited_main_message_loop;
181 185
182 static const char* kSiteProcessMapKeyName = "content_site_process_map"; 186 static const char* kSiteProcessMapKeyName = "content_site_process_map";
183 187
184 namespace content { 188 namespace content {
185 namespace { 189 namespace {
186 190
187 void CacheShaderInfo(int32 id, base::FilePath path) { 191 void CacheShaderInfo(int32 id, base::FilePath path) {
188 ShaderCacheFactory::GetInstance()->SetCacheInfo(id, path); 192 ShaderCacheFactory::GetInstance()->SetCacheInfo(id, path);
189 } 193 }
(...skipping 2090 matching lines...) Expand 10 before | Expand all | Expand 10 after
2280 gfx::GpuMemoryBufferHandle handle; 2284 gfx::GpuMemoryBufferHandle handle;
2281 handle.type = gfx::SURFACE_TEXTURE_BUFFER; 2285 handle.type = gfx::SURFACE_TEXTURE_BUFFER;
2282 handle.surface_texture_id = 2286 handle.surface_texture_id =
2283 gfx::SurfaceTextureId(surface_texture_id, GetID()); 2287 gfx::SurfaceTextureId(surface_texture_id, GetID());
2284 GpuMemoryBufferAllocated(reply, handle); 2288 GpuMemoryBufferAllocated(reply, handle);
2285 return; 2289 return;
2286 } 2290 }
2287 } 2291 }
2288 #endif 2292 #endif
2289 2293
2294 #if defined(OS_LINUX)
2295 gfx::GpuMemoryBufferHandle handle;
2296
2297 uint64 stride = static_cast<uint64>(width) *
2298 GpuMemoryBufferImpl::BytesPerPixel(internalformat);
2299 if (stride > std::numeric_limits<uint32>::max()) {
2300 handle.type = gfx::EMPTY_BUFFER;
2301 GpuMemoryBufferAllocated(reply, handle);
2302 return;
2303 }
2304 //if (!buffer_manager_)
2305 //buffer_manager_ = new DRIBufferManager();
2306 handle.type = gfx::DMA_BUFFER;
2307 DRIBufferManager::CreateBuffer(width, height, handle);
2308 if (handle.handle.fd > 0 && handle.card_handle.fd > 0) {
2309 GpuMemoryBufferAllocated(reply, handle);
2310 return;
2311 }
2312 #endif
2313
2290 GpuMemoryBufferImpl::AllocateForChildProcess( 2314 GpuMemoryBufferImpl::AllocateForChildProcess(
2291 gfx::Size(width, height), 2315 gfx::Size(width, height),
2292 internalformat, 2316 internalformat,
2293 usage, 2317 usage,
2294 GetHandle(), 2318 GetHandle(),
2295 base::Bind(&RenderProcessHostImpl::GpuMemoryBufferAllocated, 2319 base::Bind(&RenderProcessHostImpl::GpuMemoryBufferAllocated,
2296 weak_factory_.GetWeakPtr(), 2320 weak_factory_.GetWeakPtr(),
2297 reply)); 2321 reply));
2298 } 2322 }
2299 2323
2300 void RenderProcessHostImpl::GpuMemoryBufferAllocated( 2324 void RenderProcessHostImpl::GpuMemoryBufferAllocated(
2301 IPC::Message* reply, 2325 IPC::Message* reply,
2302 const gfx::GpuMemoryBufferHandle& handle) { 2326 const gfx::GpuMemoryBufferHandle& handle) {
2303 DCHECK_CURRENTLY_ON(BrowserThread::UI); 2327 DCHECK_CURRENTLY_ON(BrowserThread::UI);
2304 ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer::WriteReplyParams(reply, 2328 ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer::WriteReplyParams(reply,
2305 handle); 2329 handle);
2306 Send(reply); 2330 Send(reply);
2307 } 2331 }
2308 2332
2309 } // namespace content 2333 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/dri_buffer_manager.cc ('k') | content/common/child_process_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698