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

Side by Side Diff: content/browser/plugin_process_host.cc

Issue 12212089: content: convert child process notifications to observer usage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: trybots Created 7 years, 10 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 #include "content/browser/plugin_process_host.h" 5 #include "content/browser/plugin_process_host.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #elif defined(OS_POSIX) 9 #elif defined(OS_POSIX)
10 #include <utility> // for pair<> 10 #include <utility> // for pair<>
(...skipping 10 matching lines...) Expand all
21 #include "base/metrics/histogram.h" 21 #include "base/metrics/histogram.h"
22 #include "base/path_service.h" 22 #include "base/path_service.h"
23 #include "base/string_util.h" 23 #include "base/string_util.h"
24 #include "base/utf_string_conversions.h" 24 #include "base/utf_string_conversions.h"
25 #include "content/browser/browser_child_process_host_impl.h" 25 #include "content/browser/browser_child_process_host_impl.h"
26 #include "content/browser/gpu/gpu_data_manager_impl.h" 26 #include "content/browser/gpu/gpu_data_manager_impl.h"
27 #include "content/browser/plugin_service_impl.h" 27 #include "content/browser/plugin_service_impl.h"
28 #include "content/common/child_process_host_impl.h" 28 #include "content/common/child_process_host_impl.h"
29 #include "content/common/plugin_messages.h" 29 #include "content/common/plugin_messages.h"
30 #include "content/common/resource_messages.h" 30 #include "content/common/resource_messages.h"
31 #include "content/public/browser/browser_child_process_observer.h"
jam 2013/02/19 18:07:09 nit: not needed?
Paweł Hajdan Jr. 2013/02/20 12:11:42 Done.
31 #include "content/public/browser/browser_thread.h" 32 #include "content/public/browser/browser_thread.h"
32 #include "content/public/browser/content_browser_client.h" 33 #include "content/public/browser/content_browser_client.h"
33 #include "content/public/browser/notification_types.h" 34 #include "content/public/browser/notification_types.h"
34 #include "content/public/browser/plugin_service.h" 35 #include "content/public/browser/plugin_service.h"
35 #include "content/public/common/content_switches.h" 36 #include "content/public/common/content_switches.h"
36 #include "content/public/common/process_type.h" 37 #include "content/public/common/process_type.h"
37 #include "ipc/ipc_switches.h" 38 #include "ipc/ipc_switches.h"
38 #include "ui/base/ui_base_switches.h" 39 #include "ui/base/ui_base_switches.h"
39 #include "ui/gfx/native_widget_types.h" 40 #include "ui/gfx/native_widget_types.h"
40 #include "ui/gl/gl_switches.h" 41 #include "ui/gl/gl_switches.h"
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 if (host->pending_requests_[i]->GetResourceContext() == context) { 336 if (host->pending_requests_[i]->GetResourceContext() == context) {
336 host->pending_requests_[i]->OnError(); 337 host->pending_requests_[i]->OnError();
337 host->pending_requests_.erase(host->pending_requests_.begin() + i); 338 host->pending_requests_.erase(host->pending_requests_.begin() + i);
338 --i; 339 --i;
339 } 340 }
340 } 341 }
341 } 342 }
342 } 343 }
343 344
344 void PluginProcessHost::OpenChannelToPlugin(Client* client) { 345 void PluginProcessHost::OpenChannelToPlugin(Client* client) {
345 process_->Notify(NOTIFICATION_CHILD_INSTANCE_CREATED); 346 BrowserThread::PostTask(
347 BrowserThread::UI, FROM_HERE,
348 base::Bind(&BrowserChildProcessHostImpl::NotifyProcessInstanceCreated,
349 process_->GetData()));
346 client->SetPluginInfo(info_); 350 client->SetPluginInfo(info_);
347 if (process_->GetHost()->IsChannelOpening()) { 351 if (process_->GetHost()->IsChannelOpening()) {
348 // The channel is already in the process of being opened. Put 352 // The channel is already in the process of being opened. Put
349 // this "open channel" request into a queue of requests that will 353 // this "open channel" request into a queue of requests that will
350 // be run once the channel is open. 354 // be run once the channel is open.
351 pending_requests_.push_back(client); 355 pending_requests_.push_back(client);
352 return; 356 return;
353 } 357 }
354 358
355 // We already have an open channel, send a request right away to plugin. 359 // We already have an open channel, send a request right away to plugin.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 void PluginProcessHost::OnChannelCreated( 406 void PluginProcessHost::OnChannelCreated(
403 const IPC::ChannelHandle& channel_handle) { 407 const IPC::ChannelHandle& channel_handle) {
404 Client* client = sent_requests_.front(); 408 Client* client = sent_requests_.front();
405 409
406 if (client) 410 if (client)
407 client->OnChannelOpened(channel_handle); 411 client->OnChannelOpened(channel_handle);
408 sent_requests_.pop_front(); 412 sent_requests_.pop_front();
409 } 413 }
410 414
411 } // namespace content 415 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698