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

Side by Side Diff: content/renderer/renderer_gl_context.cc

Issue 6862002: Merge gpu_trace_event back into base/debug/trace_event (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge to 84062 Created 9 years, 7 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/renderer/renderer_gl_context.h" 5 #include "content/renderer/renderer_gl_context.h"
6 6
7 #include "base/debug/trace_event.h"
7 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
8 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/singleton.h" 11 #include "base/memory/singleton.h"
11 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
12 #include "base/shared_memory.h" 13 #include "base/shared_memory.h"
13 #include "content/common/view_messages.h" 14 #include "content/common/view_messages.h"
14 #include "content/renderer/command_buffer_proxy.h" 15 #include "content/renderer/command_buffer_proxy.h"
15 #include "content/renderer/gpu_channel_host.h" 16 #include "content/renderer/gpu_channel_host.h"
16 #include "content/renderer/gpu_video_service_host.h" 17 #include "content/renderer/gpu_video_service_host.h"
17 #include "content/renderer/media/gles2_video_decode_context.h" 18 #include "content/renderer/media/gles2_video_decode_context.h"
18 #include "content/renderer/render_thread.h" 19 #include "content/renderer/render_thread.h"
19 #include "content/renderer/render_widget.h" 20 #include "content/renderer/render_widget.h"
20 #include "content/renderer/transport_texture_host.h" 21 #include "content/renderer/transport_texture_host.h"
21 #include "content/renderer/transport_texture_service.h" 22 #include "content/renderer/transport_texture_service.h"
22 #include "googleurl/src/gurl.h" 23 #include "googleurl/src/gurl.h"
23 #include "ipc/ipc_channel_handle.h" 24 #include "ipc/ipc_channel_handle.h"
24 25
25 #if defined(ENABLE_GPU) 26 #if defined(ENABLE_GPU)
26 #include "gpu/command_buffer/client/gles2_cmd_helper.h" 27 #include "gpu/command_buffer/client/gles2_cmd_helper.h"
27 #include "gpu/command_buffer/client/gles2_implementation.h" 28 #include "gpu/command_buffer/client/gles2_implementation.h"
28 #include "gpu/command_buffer/client/gles2_lib.h" 29 #include "gpu/command_buffer/client/gles2_lib.h"
29 #include "gpu/command_buffer/common/constants.h" 30 #include "gpu/command_buffer/common/constants.h"
30 #include "gpu/common/gpu_trace_event.h"
31 #include "gpu/GLES2/gles2_command_buffer.h" 31 #include "gpu/GLES2/gles2_command_buffer.h"
32 #endif // ENABLE_GPU 32 #endif // ENABLE_GPU
33 33
34 namespace { 34 namespace {
35 35
36 const int32 kCommandBufferSize = 1024 * 1024; 36 const int32 kCommandBufferSize = 1024 * 1024;
37 // TODO(kbr): make the transfer buffer size configurable via context 37 // TODO(kbr): make the transfer buffer size configurable via context
38 // creation attributes. 38 // creation attributes.
39 const int32 kTransferBufferSize = 1024 * 1024; 39 const int32 kTransferBufferSize = 1024 * 1024;
40 40
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 if (context->command_buffer_->GetLastState().error != gpu::error::kNoError) 286 if (context->command_buffer_->GetLastState().error != gpu::error::kNoError)
287 return false; 287 return false;
288 } else { 288 } else {
289 gles2::SetGLContext(NULL); 289 gles2::SetGLContext(NULL);
290 } 290 }
291 291
292 return true; 292 return true;
293 } 293 }
294 294
295 bool RendererGLContext::SwapBuffers() { 295 bool RendererGLContext::SwapBuffers() {
296 GPU_TRACE_EVENT0("gpu", "RendererGLContext::SwapBuffers"); 296 TRACE_EVENT0("gpu", "RendererGLContext::SwapBuffers");
297 // Don't request latest error status from service. Just use the locally cached 297 // Don't request latest error status from service. Just use the locally cached
298 // information from the last flush. 298 // information from the last flush.
299 if (command_buffer_->GetLastState().error != gpu::error::kNoError) 299 if (command_buffer_->GetLastState().error != gpu::error::kNoError)
300 return false; 300 return false;
301 301
302 gles2_implementation_->SwapBuffers(); 302 gles2_implementation_->SwapBuffers();
303 return true; 303 return true;
304 } 304 }
305 305
306 media::VideoDecodeEngine* RendererGLContext::CreateVideoDecodeEngine() { 306 media::VideoDecodeEngine* RendererGLContext::CreateVideoDecodeEngine() {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 } 369 }
370 370
371 bool RendererGLContext::Initialize(bool onscreen, 371 bool RendererGLContext::Initialize(bool onscreen,
372 gfx::PluginWindowHandle render_surface, 372 gfx::PluginWindowHandle render_surface,
373 int render_view_id, 373 int render_view_id,
374 const gfx::Size& size, 374 const gfx::Size& size,
375 const char* allowed_extensions, 375 const char* allowed_extensions,
376 const int32* attrib_list, 376 const int32* attrib_list,
377 const GURL& active_url) { 377 const GURL& active_url) {
378 DCHECK(size.width() >= 0 && size.height() >= 0); 378 DCHECK(size.width() >= 0 && size.height() >= 0);
379 GPU_TRACE_EVENT2("gpu", "RendererGLContext::Initialize", 379 TRACE_EVENT2("gpu", "RendererGLContext::Initialize",
380 "on_screen", onscreen, "num_pixels", size.GetArea()); 380 "on_screen", onscreen, "num_pixels", size.GetArea());
381 381
382 if (channel_->state() != GpuChannelHost::kConnected) 382 if (channel_->state() != GpuChannelHost::kConnected)
383 return false; 383 return false;
384 384
385 // Ensure the gles2 library is initialized first in a thread safe way. 385 // Ensure the gles2 library is initialized first in a thread safe way.
386 g_gles2_initializer.Get(); 386 g_gles2_initializer.Get();
387 387
388 // Allocate a frame buffer ID with respect to the parent. 388 // Allocate a frame buffer ID with respect to the parent.
389 if (parent_.get()) { 389 if (parent_.get()) {
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 } 586 }
587 587
588 bool RendererGLContext::GetChildToParentLatch(uint32* child_to_parent_latch) { 588 bool RendererGLContext::GetChildToParentLatch(uint32* child_to_parent_latch) {
589 if (parent_.get()) { 589 if (parent_.get()) {
590 *child_to_parent_latch = child_to_parent_latch_; 590 *child_to_parent_latch = child_to_parent_latch_;
591 return true; 591 return true;
592 } 592 }
593 return false; 593 return false;
594 } 594 }
595 595
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698