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

Side by Side Diff: content/common/gpu/gpu_channel.cc

Issue 780133002: Add optimization for CHROMIUM_subscribe_uniform extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: piman@ review Created 6 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 unified diff | Download patch
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 #if defined(OS_WIN) 5 #if defined(OS_WIN)
6 #include <windows.h> 6 #include <windows.h>
7 #endif 7 #endif
8 8
9 #include "content/common/gpu/gpu_channel.h" 9 #include "content/common/gpu/gpu_channel.h"
10 10
(...skipping 11 matching lines...) Expand all
22 #include "content/common/gpu/gpu_channel_manager.h" 22 #include "content/common/gpu/gpu_channel_manager.h"
23 #include "content/common/gpu/gpu_memory_buffer_factory.h" 23 #include "content/common/gpu/gpu_memory_buffer_factory.h"
24 #include "content/common/gpu/gpu_messages.h" 24 #include "content/common/gpu/gpu_messages.h"
25 #include "content/public/common/content_switches.h" 25 #include "content/public/common/content_switches.h"
26 #include "gpu/command_buffer/common/mailbox.h" 26 #include "gpu/command_buffer/common/mailbox.h"
27 #include "gpu/command_buffer/common/value_state.h" 27 #include "gpu/command_buffer/common/value_state.h"
28 #include "gpu/command_buffer/service/gpu_scheduler.h" 28 #include "gpu/command_buffer/service/gpu_scheduler.h"
29 #include "gpu/command_buffer/service/image_factory.h" 29 #include "gpu/command_buffer/service/image_factory.h"
30 #include "gpu/command_buffer/service/mailbox_manager_impl.h" 30 #include "gpu/command_buffer/service/mailbox_manager_impl.h"
31 #include "gpu/command_buffer/service/sync_point_manager.h" 31 #include "gpu/command_buffer/service/sync_point_manager.h"
32 #include "gpu/command_buffer/service/valuebuffer_manager.h"
32 #include "ipc/ipc_channel.h" 33 #include "ipc/ipc_channel.h"
33 #include "ipc/message_filter.h" 34 #include "ipc/message_filter.h"
34 #include "ui/gl/gl_context.h" 35 #include "ui/gl/gl_context.h"
35 #include "ui/gl/gl_image_shared_memory.h" 36 #include "ui/gl/gl_image_shared_memory.h"
36 #include "ui/gl/gl_surface.h" 37 #include "ui/gl/gl_surface.h"
37 38
38 #if defined(OS_POSIX) 39 #if defined(OS_POSIX)
39 #include "ipc/ipc_channel_posix.h" 40 #include "ipc/ipc_channel_posix.h"
40 #endif 41 #endif
41 42
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 num_stubs_descheduled_(0), 419 num_stubs_descheduled_(0),
419 allow_future_sync_points_(allow_future_sync_points), 420 allow_future_sync_points_(allow_future_sync_points),
420 weak_factory_(this) { 421 weak_factory_(this) {
421 DCHECK(gpu_channel_manager); 422 DCHECK(gpu_channel_manager);
422 DCHECK(client_id); 423 DCHECK(client_id);
423 424
424 channel_id_ = IPC::Channel::GenerateVerifiedChannelID("gpu"); 425 channel_id_ = IPC::Channel::GenerateVerifiedChannelID("gpu");
425 const base::CommandLine* command_line = 426 const base::CommandLine* command_line =
426 base::CommandLine::ForCurrentProcess(); 427 base::CommandLine::ForCurrentProcess();
427 log_messages_ = command_line->HasSwitch(switches::kLogPluginMessages); 428 log_messages_ = command_line->HasSwitch(switches::kLogPluginMessages);
429
430 subscription_ref_set_ = new gpu::gles2::SubscriptionRefSet();
431 subscription_ref_set_->AddObserver(this);
428 } 432 }
429 433
430 GpuChannel::~GpuChannel() { 434 GpuChannel::~GpuChannel() {
431 STLDeleteElements(&deferred_messages_); 435 STLDeleteElements(&deferred_messages_);
436 subscription_ref_set_->RemoveObserver(this);
432 if (preempting_flag_.get()) 437 if (preempting_flag_.get())
433 preempting_flag_->Reset(); 438 preempting_flag_->Reset();
434 } 439 }
435 440
436 void GpuChannel::Init(base::MessageLoopProxy* io_message_loop, 441 void GpuChannel::Init(base::MessageLoopProxy* io_message_loop,
437 base::WaitableEvent* shutdown_event) { 442 base::WaitableEvent* shutdown_event) {
438 DCHECK(!channel_.get()); 443 DCHECK(!channel_.get());
439 444
440 // Map renderer ID to a (single) channel to that process. 445 // Map renderer ID to a (single) channel to that process.
441 channel_ = IPC::SyncChannel::Create(channel_id_, 446 channel_ = IPC::SyncChannel::Create(channel_id_,
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 } 510 }
506 511
507 if (!channel_) { 512 if (!channel_) {
508 delete message; 513 delete message;
509 return false; 514 return false;
510 } 515 }
511 516
512 return channel_->Send(message); 517 return channel_->Send(message);
513 } 518 }
514 519
520 void GpuChannel::OnAddSubscription(unsigned int target) {
521 gpu_channel_manager()->Send(
522 new GpuHostMsg_AddSubscription(client_id_, target));
523 }
524
525 void GpuChannel::OnRemoveSubscription(unsigned int target) {
526 gpu_channel_manager()->Send(
527 new GpuHostMsg_RemoveSubscription(client_id_, target));
528 }
529
515 void GpuChannel::RequeueMessage() { 530 void GpuChannel::RequeueMessage() {
516 DCHECK(currently_processing_message_); 531 DCHECK(currently_processing_message_);
517 deferred_messages_.push_front( 532 deferred_messages_.push_front(
518 new IPC::Message(*currently_processing_message_)); 533 new IPC::Message(*currently_processing_message_));
519 messages_processed_--; 534 messages_processed_--;
520 currently_processing_message_ = NULL; 535 currently_processing_message_ = NULL;
521 } 536 }
522 537
523 void GpuChannel::OnScheduled() { 538 void GpuChannel::OnScheduled() {
524 if (handle_messages_scheduled_) 539 if (handle_messages_scheduled_)
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 bool use_virtualized_gl_context = false; 589 bool use_virtualized_gl_context = false;
575 #if defined(OS_MACOSX) 590 #if defined(OS_MACOSX)
576 use_virtualized_gl_context = true; 591 use_virtualized_gl_context = true;
577 #endif 592 #endif
578 593
579 scoped_ptr<GpuCommandBufferStub> stub( 594 scoped_ptr<GpuCommandBufferStub> stub(
580 new GpuCommandBufferStub(this, 595 new GpuCommandBufferStub(this,
581 share_group, 596 share_group,
582 window, 597 window,
583 mailbox_manager_.get(), 598 mailbox_manager_.get(),
599 subscription_ref_set_.get(),
584 pending_valuebuffer_state_.get(), 600 pending_valuebuffer_state_.get(),
585 gfx::Size(), 601 gfx::Size(),
586 disallowed_features_, 602 disallowed_features_,
587 init_params.attribs, 603 init_params.attribs,
588 init_params.gpu_preference, 604 init_params.gpu_preference,
589 use_virtualized_gl_context, 605 use_virtualized_gl_context,
590 route_id, 606 route_id,
591 surface_id, 607 surface_id,
592 watchdog_, 608 watchdog_,
593 software_, 609 software_,
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 int32 route_id, 749 int32 route_id,
734 bool* succeeded) { 750 bool* succeeded) {
735 TRACE_EVENT0("gpu", "GpuChannel::OnCreateOffscreenCommandBuffer"); 751 TRACE_EVENT0("gpu", "GpuChannel::OnCreateOffscreenCommandBuffer");
736 GpuCommandBufferStub* share_group = stubs_.Lookup(init_params.share_group_id); 752 GpuCommandBufferStub* share_group = stubs_.Lookup(init_params.share_group_id);
737 753
738 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub( 754 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub(
739 this, 755 this,
740 share_group, 756 share_group,
741 gfx::GLSurfaceHandle(), 757 gfx::GLSurfaceHandle(),
742 mailbox_manager_.get(), 758 mailbox_manager_.get(),
759 subscription_ref_set_.get(),
743 pending_valuebuffer_state_.get(), 760 pending_valuebuffer_state_.get(),
744 size, 761 size,
745 disallowed_features_, 762 disallowed_features_,
746 init_params.attribs, 763 init_params.attribs,
747 init_params.gpu_preference, 764 init_params.gpu_preference,
748 false, 765 false,
749 route_id, 766 route_id,
750 0, 767 0,
751 watchdog_, 768 watchdog_,
752 software_, 769 software_,
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 } 872 }
856 } 873 }
857 } 874 }
858 875
859 void GpuChannel::HandleUpdateValueState( 876 void GpuChannel::HandleUpdateValueState(
860 unsigned int target, const gpu::ValueState& state) { 877 unsigned int target, const gpu::ValueState& state) {
861 pending_valuebuffer_state_->UpdateState(target, state); 878 pending_valuebuffer_state_->UpdateState(target, state);
862 } 879 }
863 880
864 } // namespace content 881 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698