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

Side by Side Diff: content/plugin/plugin_channel.cc

Issue 9215005: Revert 117824 - Convert use of int ms to TimeDelta in files owned by brettw. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 11 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) 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/plugin/plugin_channel.h" 5 #include "content/plugin/plugin_channel.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/process_util.h" 9 #include "base/process_util.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
11 #include "base/synchronization/lock.h" 11 #include "base/synchronization/lock.h"
(...skipping 12 matching lines...) Expand all
24 #include "ipc/ipc_channel_posix.h" 24 #include "ipc/ipc_channel_posix.h"
25 #endif 25 #endif
26 26
27 namespace { 27 namespace {
28 28
29 void PluginReleaseCallback() { 29 void PluginReleaseCallback() {
30 ChildProcess::current()->ReleaseProcess(); 30 ChildProcess::current()->ReleaseProcess();
31 } 31 }
32 32
33 // How long we wait before releasing the plugin process. 33 // How long we wait before releasing the plugin process.
34 const int kPluginReleaseTimeMinutes = 5; 34 const int kPluginReleaseTimeMs = 5 * 60 * 1000; // 5 minutes
35 35
36 } // namespace 36 } // namespace
37 37
38 // If a sync call to the renderer results in a modal dialog, we need to have a 38 // If a sync call to the renderer results in a modal dialog, we need to have a
39 // way to know so that we can run a nested message loop to simulate what would 39 // way to know so that we can run a nested message loop to simulate what would
40 // happen in a single process browser and avoid deadlock. 40 // happen in a single process browser and avoid deadlock.
41 class PluginChannel::MessageFilter : public IPC::ChannelProxy::MessageFilter { 41 class PluginChannel::MessageFilter : public IPC::ChannelProxy::MessageFilter {
42 public: 42 public:
43 MessageFilter() : channel_(NULL) { } 43 MessageFilter() : channel_(NULL) { }
44 ~MessageFilter() { 44 ~MessageFilter() {
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 ChildProcess::current()->AddRefProcess(); 170 ChildProcess::current()->AddRefProcess();
171 const CommandLine* command_line = CommandLine::ForCurrentProcess(); 171 const CommandLine* command_line = CommandLine::ForCurrentProcess();
172 log_messages_ = command_line->HasSwitch(switches::kLogPluginMessages); 172 log_messages_ = command_line->HasSwitch(switches::kLogPluginMessages);
173 } 173 }
174 174
175 PluginChannel::~PluginChannel() { 175 PluginChannel::~PluginChannel() {
176 if (renderer_handle_) 176 if (renderer_handle_)
177 base::CloseProcessHandle(renderer_handle_); 177 base::CloseProcessHandle(renderer_handle_);
178 178
179 MessageLoop::current()->PostDelayedTask( 179 MessageLoop::current()->PostDelayedTask(
180 FROM_HERE, 180 FROM_HERE, base::Bind(&PluginReleaseCallback), kPluginReleaseTimeMs);
181 base::Bind(&PluginReleaseCallback),
182 base::TimeDelta::FromMinutes(kPluginReleaseTimeMinutes));
183 } 181 }
184 182
185 bool PluginChannel::Send(IPC::Message* msg) { 183 bool PluginChannel::Send(IPC::Message* msg) {
186 in_send_++; 184 in_send_++;
187 if (log_messages_) { 185 if (log_messages_) {
188 VLOG(1) << "sending message @" << msg << " on channel @" << this 186 VLOG(1) << "sending message @" << msg << " on channel @" << this
189 << " with type " << msg->type(); 187 << " with type " << msg->type();
190 } 188 }
191 bool result = NPChannelBase::Send(msg); 189 bool result = NPChannelBase::Send(msg);
192 in_send_--; 190 in_send_--;
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 bool PluginChannel::Init(base::MessageLoopProxy* ipc_message_loop, 325 bool PluginChannel::Init(base::MessageLoopProxy* ipc_message_loop,
328 bool create_pipe_now, 326 bool create_pipe_now,
329 base::WaitableEvent* shutdown_event) { 327 base::WaitableEvent* shutdown_event) {
330 if (!NPChannelBase::Init(ipc_message_loop, create_pipe_now, shutdown_event)) 328 if (!NPChannelBase::Init(ipc_message_loop, create_pipe_now, shutdown_event))
331 return false; 329 return false;
332 330
333 channel_->AddFilter(filter_.get()); 331 channel_->AddFilter(filter_.get());
334 return true; 332 return true;
335 } 333 }
336 334
OLDNEW
« no previous file with comments | « content/browser/renderer_host/resource_dispatcher_host_uitest.cc ('k') | content/plugin/plugin_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698