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

Side by Side Diff: chrome/renderer/render_thread.cc

Issue 1546001: Split GpuProcessHost into GpuProcessHostUIShim, which runs on the UI... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 8 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 | « chrome/renderer/gpu_channel_host.cc ('k') | no next file » | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/renderer/render_thread.h" 5 #include "chrome/renderer/render_thread.h"
6 6
7 #include <v8.h> 7 #include <v8.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <limits> 10 #include <limits>
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 return; 680 return;
681 681
682 std::set<std::string> active_extensions; 682 std::set<std::string> active_extensions;
683 user_script_slave_->GetActiveExtensions(&active_extensions); 683 user_script_slave_->GetActiveExtensions(&active_extensions);
684 ExtensionProcessBindings::GetActiveExtensions(&active_extensions); 684 ExtensionProcessBindings::GetActiveExtensions(&active_extensions);
685 child_process_logging::SetActiveExtensions(active_extensions); 685 child_process_logging::SetActiveExtensions(active_extensions);
686 } 686 }
687 687
688 void RenderThread::EstablishGpuChannel() { 688 void RenderThread::EstablishGpuChannel() {
689 if (gpu_channel_.get()) { 689 if (gpu_channel_.get()) {
690 // Do nothing if we are already establishing GPU channel. 690 // Do nothing if we already have a GPU channel or are already
691 if (gpu_channel_->state() == GpuChannelHost::UNCONNECTED) 691 // establishing one.
692 if (gpu_channel_->state() == GpuChannelHost::UNCONNECTED ||
693 gpu_channel_->state() == GpuChannelHost::CONNECTED)
692 return; 694 return;
693 695
694 // Recreate the channel if it has been lost. 696 // Recreate the channel if it has been lost.
695 if (gpu_channel_->state() == GpuChannelHost::LOST) 697 if (gpu_channel_->state() == GpuChannelHost::LOST)
696 gpu_channel_ = NULL; 698 gpu_channel_ = NULL;
697 } 699 }
698 700
699 if (!gpu_channel_.get()) 701 if (!gpu_channel_.get())
700 gpu_channel_ = new GpuChannelHost; 702 gpu_channel_ = new GpuChannelHost;
701 703
702 // Ask the browser for the channel name. 704 // Ask the browser for the channel name.
703 Send(new ViewHostMsg_EstablishGpuChannel()); 705 Send(new ViewHostMsg_EstablishGpuChannel());
704 } 706 }
705 707
706 GpuChannelHost* RenderThread::EstablishGpuChannelSync() { 708 GpuChannelHost* RenderThread::EstablishGpuChannelSync() {
707 EstablishGpuChannel(); 709 // We may need to retry the connection establishment if an existing
708 Send(new ViewHostMsg_SynchronizeGpu()); 710 // connection has gone bad, which will not be detected in
711 // EstablishGpuChannel since we do not send duplicate
712 // ViewHostMsg_EstablishGpuChannel messages -- doing so breaks the
713 // preexisting connection in bad ways.
714 bool retry = true;
715 for (int i = 0; i < 2 && retry; ++i) {
716 EstablishGpuChannel();
717 retry = !Send(new ViewHostMsg_SynchronizeGpu());
718 }
709 // TODO(kbr): the GPU channel is still in the unconnected state at this point. 719 // TODO(kbr): the GPU channel is still in the unconnected state at this point.
710 // Need to figure out whether it is really safe to return it. 720 // Need to figure out whether it is really safe to return it.
711 return gpu_channel_.get(); 721 return gpu_channel_.get();
712 } 722 }
713 723
714 GpuChannelHost* RenderThread::GetGpuChannel() { 724 GpuChannelHost* RenderThread::GetGpuChannel() {
715 if (!gpu_channel_.get()) 725 if (!gpu_channel_.get())
716 return NULL; 726 return NULL;
717 727
718 if (gpu_channel_->state() != GpuChannelHost::CONNECTED) 728 if (gpu_channel_->state() != GpuChannelHost::CONNECTED)
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 #endif 1001 #endif
992 1002
993 if (channel_handle.name.size() != 0) { 1003 if (channel_handle.name.size() != 0) {
994 // Connect to the GPU process if a channel name was received. 1004 // Connect to the GPU process if a channel name was received.
995 gpu_channel_->Connect(channel_handle.name); 1005 gpu_channel_->Connect(channel_handle.name);
996 } else { 1006 } else {
997 // Otherwise cancel the connection. 1007 // Otherwise cancel the connection.
998 gpu_channel_ = NULL; 1008 gpu_channel_ = NULL;
999 } 1009 }
1000 } 1010 }
OLDNEW
« no previous file with comments | « chrome/renderer/gpu_channel_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698