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

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

Issue 14335017: content: Use base::MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 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) 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 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 // messages flow between the browser and renderer, this thread is required 501 // messages flow between the browser and renderer, this thread is required
502 // to prevent a deadlock in single-process mode. Since the primordial 502 // to prevent a deadlock in single-process mode. Since the primordial
503 // thread in the renderer process runs the WebKit code and can sometimes 503 // thread in the renderer process runs the WebKit code and can sometimes
504 // make blocking calls to the UI thread (i.e. this thread), they need to run 504 // make blocking calls to the UI thread (i.e. this thread), they need to run
505 // on separate threads. 505 // on separate threads.
506 in_process_renderer_.reset(new RendererMainThread(channel_id)); 506 in_process_renderer_.reset(new RendererMainThread(channel_id));
507 507
508 base::Thread::Options options; 508 base::Thread::Options options;
509 #if defined(OS_WIN) && !defined(OS_MACOSX) 509 #if defined(OS_WIN) && !defined(OS_MACOSX)
510 // In-process plugins require this to be a UI message loop. 510 // In-process plugins require this to be a UI message loop.
511 options.message_loop_type = MessageLoop::TYPE_UI; 511 options.message_loop_type = base::MessageLoop::TYPE_UI;
512 #else 512 #else
513 // We can't have multiple UI loops on Linux and Android, so we don't support 513 // We can't have multiple UI loops on Linux and Android, so we don't support
514 // in-process plugins. 514 // in-process plugins.
515 options.message_loop_type = MessageLoop::TYPE_DEFAULT; 515 options.message_loop_type = base::MessageLoop::TYPE_DEFAULT;
516 #endif 516 #endif
517 in_process_renderer_->StartWithOptions(options); 517 in_process_renderer_->StartWithOptions(options);
518 518
519 OnProcessLaunched(); // Fake a callback that the process is ready. 519 OnProcessLaunched(); // Fake a callback that the process is ready.
520 } else { 520 } else {
521 // Build command line for renderer. We call AppendRendererCommandLine() 521 // Build command line for renderer. We call AppendRendererCommandLine()
522 // first so the process type argument will appear first. 522 // first so the process type argument will appear first.
523 CommandLine* cmd_line = new CommandLine(renderer_path); 523 CommandLine* cmd_line = new CommandLine(renderer_path);
524 if (!renderer_prefix.empty()) 524 if (!renderer_prefix.empty())
525 cmd_line->PrependWrapper(renderer_prefix); 525 cmd_line->PrependWrapper(renderer_prefix);
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 1251
1252 void RenderProcessHostImpl::Cleanup() { 1252 void RenderProcessHostImpl::Cleanup() {
1253 // When no other owners of this object, we can delete ourselves 1253 // When no other owners of this object, we can delete ourselves
1254 if (render_widget_hosts_.IsEmpty()) { 1254 if (render_widget_hosts_.IsEmpty()) {
1255 DCHECK_EQ(0, pending_views_); 1255 DCHECK_EQ(0, pending_views_);
1256 NotificationService::current()->Notify( 1256 NotificationService::current()->Notify(
1257 NOTIFICATION_RENDERER_PROCESS_TERMINATED, 1257 NOTIFICATION_RENDERER_PROCESS_TERMINATED,
1258 Source<RenderProcessHost>(this), 1258 Source<RenderProcessHost>(this),
1259 NotificationService::NoDetails()); 1259 NotificationService::NoDetails());
1260 1260
1261 MessageLoop::current()->DeleteSoon(FROM_HERE, this); 1261 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
1262 deleting_soon_ = true; 1262 deleting_soon_ = true;
1263 // It's important not to wait for the DeleteTask to delete the channel 1263 // It's important not to wait for the DeleteTask to delete the channel
1264 // proxy. Kill it off now. That way, in case the profile is going away, the 1264 // proxy. Kill it off now. That way, in case the profile is going away, the
1265 // rest of the objects attached to this RenderProcessHost start going 1265 // rest of the objects attached to this RenderProcessHost start going
1266 // away first, since deleting the channel proxy will post a 1266 // away first, since deleting the channel proxy will post a
1267 // OnChannelClosed() to IPC::ChannelProxy::Context on the IO thread. 1267 // OnChannelClosed() to IPC::ChannelProxy::Context on the IO thread.
1268 channel_.reset(); 1268 channel_.reset();
1269 gpu_message_filter_ = NULL; 1269 gpu_message_filter_ = NULL;
1270 1270
1271 // Remove ourself from the list of renderer processes so that we can't be 1271 // Remove ourself from the list of renderer processes so that we can't be
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
1742 TRACE_EVENT0("renderer_host", 1742 TRACE_EVENT0("renderer_host",
1743 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); 1743 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost");
1744 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; 1744 AcceleratedSurfaceMsg_BufferPresented_Params ack_params;
1745 ack_params.sync_point = 0; 1745 ack_params.sync_point = 0;
1746 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, 1746 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id,
1747 gpu_process_host_id, 1747 gpu_process_host_id,
1748 ack_params); 1748 ack_params);
1749 } 1749 }
1750 1750
1751 } // namespace content 1751 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/popup_menu_helper_mac.mm ('k') | content/browser/renderer_host/render_widget_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698