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

Side by Side Diff: content/ppapi_plugin/ppapi_thread.cc

Issue 11883026: Add two new debug URLs for Pepper Flash: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 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
« no previous file with comments | « content/ppapi_plugin/ppapi_thread.h ('k') | content/public/common/url_constants.h » ('j') | 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) 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/ppapi_plugin/ppapi_thread.h" 5 #include "content/ppapi_plugin/ppapi_thread.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/process_util.h" 11 #include "base/process_util.h"
12 #include "base/rand_util.h" 12 #include "base/rand_util.h"
13 #include "base/stringprintf.h" 13 #include "base/stringprintf.h"
14 #include "base/threading/platform_thread.h"
15 #include "base/time.h"
14 #include "base/utf_string_conversions.h" 16 #include "base/utf_string_conversions.h"
15 #include "content/common/child_process.h" 17 #include "content/common/child_process.h"
16 #include "content/common/child_process_messages.h" 18 #include "content/common/child_process_messages.h"
17 #include "content/ppapi_plugin/broker_process_dispatcher.h" 19 #include "content/ppapi_plugin/broker_process_dispatcher.h"
18 #include "content/ppapi_plugin/plugin_process_dispatcher.h" 20 #include "content/ppapi_plugin/plugin_process_dispatcher.h"
19 #include "content/ppapi_plugin/ppapi_webkitplatformsupport_impl.h" 21 #include "content/ppapi_plugin/ppapi_webkitplatformsupport_impl.h"
20 #include "content/public/common/content_client.h" 22 #include "content/public/common/content_client.h"
21 #include "content/public/common/pepper_plugin_info.h" 23 #include "content/public/common/pepper_plugin_info.h"
22 #include "content/public/common/sandbox_init.h" 24 #include "content/public/common/sandbox_init.h"
23 #include "content/public/plugin/content_plugin_client.h" 25 #include "content/public/plugin/content_plugin_client.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 133
132 // Note that this function is called only for messages from the channel to the 134 // Note that this function is called only for messages from the channel to the
133 // browser process. Messages from the renderer process are sent via a different 135 // browser process. Messages from the renderer process are sent via a different
134 // channel that ends up at Dispatcher::OnMessageReceived. 136 // channel that ends up at Dispatcher::OnMessageReceived.
135 bool PpapiThread::OnControlMessageReceived(const IPC::Message& msg) { 137 bool PpapiThread::OnControlMessageReceived(const IPC::Message& msg) {
136 bool handled = true; 138 bool handled = true;
137 IPC_BEGIN_MESSAGE_MAP(PpapiThread, msg) 139 IPC_BEGIN_MESSAGE_MAP(PpapiThread, msg)
138 IPC_MESSAGE_HANDLER(PpapiMsg_LoadPlugin, OnLoadPlugin) 140 IPC_MESSAGE_HANDLER(PpapiMsg_LoadPlugin, OnLoadPlugin)
139 IPC_MESSAGE_HANDLER(PpapiMsg_CreateChannel, OnCreateChannel) 141 IPC_MESSAGE_HANDLER(PpapiMsg_CreateChannel, OnCreateChannel)
140 IPC_MESSAGE_HANDLER(PpapiMsg_SetNetworkState, OnSetNetworkState) 142 IPC_MESSAGE_HANDLER(PpapiMsg_SetNetworkState, OnSetNetworkState)
143 IPC_MESSAGE_HANDLER(PpapiMsg_Crash, OnCrash)
144 IPC_MESSAGE_HANDLER(PpapiMsg_Hang, OnHang)
141 IPC_MESSAGE_HANDLER(PpapiPluginMsg_ResourceReply, OnResourceReply) 145 IPC_MESSAGE_HANDLER(PpapiPluginMsg_ResourceReply, OnResourceReply)
142 IPC_MESSAGE_UNHANDLED(handled = false) 146 IPC_MESSAGE_UNHANDLED(handled = false)
143 IPC_END_MESSAGE_MAP() 147 IPC_END_MESSAGE_MAP()
144 return handled; 148 return handled;
145 } 149 }
146 150
147 void PpapiThread::OnChannelConnected(int32 peer_pid) { 151 void PpapiThread::OnChannelConnected(int32 peer_pid) {
148 ChildThread::OnChannelConnected(peer_pid); 152 ChildThread::OnChannelConnected(peer_pid);
149 #if defined(OS_WIN) 153 #if defined(OS_WIN)
150 if (is_broker_) 154 if (is_broker_)
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 // first unless the plugin has dev permissions, so we don't need to check 379 // first unless the plugin has dev permissions, so we don't need to check
376 // again here. We don't want random plugins depending on this dev interface. 380 // again here. We don't want random plugins depending on this dev interface.
377 if (!plugin_entry_points_.get_interface) 381 if (!plugin_entry_points_.get_interface)
378 return; 382 return;
379 const PPP_NetworkState_Dev* ns = static_cast<const PPP_NetworkState_Dev*>( 383 const PPP_NetworkState_Dev* ns = static_cast<const PPP_NetworkState_Dev*>(
380 plugin_entry_points_.get_interface(PPP_NETWORK_STATE_DEV_INTERFACE)); 384 plugin_entry_points_.get_interface(PPP_NETWORK_STATE_DEV_INTERFACE));
381 if (ns) 385 if (ns)
382 ns->SetOnLine(PP_FromBool(online)); 386 ns->SetOnLine(PP_FromBool(online));
383 } 387 }
384 388
389 void PpapiThread::OnCrash() {
390 // Intentionally crash upon the request of the browser.
391 volatile int* null_pointer = NULL;
392 *null_pointer = 0;
393 }
394
395 void PpapiThread::OnHang() {
396 // Intentionally hang upon the request of the browser.
397 for (;;)
398 base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(1));
399 }
400
385 bool PpapiThread::SetupRendererChannel(base::ProcessId renderer_pid, 401 bool PpapiThread::SetupRendererChannel(base::ProcessId renderer_pid,
386 int renderer_child_id, 402 int renderer_child_id,
387 bool incognito, 403 bool incognito,
388 IPC::ChannelHandle* handle) { 404 IPC::ChannelHandle* handle) {
389 DCHECK(is_broker_ == (connect_instance_func_ != NULL)); 405 DCHECK(is_broker_ == (connect_instance_func_ != NULL));
390 IPC::ChannelHandle plugin_handle; 406 IPC::ChannelHandle plugin_handle;
391 plugin_handle.name = IPC::Channel::GenerateVerifiedChannelID( 407 plugin_handle.name = IPC::Channel::GenerateVerifiedChannelID(
392 StringPrintf("%d.r%d", base::GetCurrentProcId(), renderer_child_id)); 408 StringPrintf("%d.r%d", base::GetCurrentProcId(), renderer_child_id));
393 409
394 ppapi::proxy::ProxyChannel* dispatcher = NULL; 410 ppapi::proxy::ProxyChannel* dispatcher = NULL;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 456
441 // plugin() is NULL when in-process. Which is fine, because this is 457 // plugin() is NULL when in-process. Which is fine, because this is
442 // just a hook for setting the process name. 458 // just a hook for setting the process name.
443 if (GetContentClient()->plugin()) { 459 if (GetContentClient()->plugin()) {
444 GetContentClient()->plugin()->PluginProcessStarted( 460 GetContentClient()->plugin()->PluginProcessStarted(
445 path.BaseName().RemoveExtension().LossyDisplayName()); 461 path.BaseName().RemoveExtension().LossyDisplayName());
446 } 462 }
447 } 463 }
448 464
449 } // namespace content 465 } // namespace content
OLDNEW
« no previous file with comments | « content/ppapi_plugin/ppapi_thread.h ('k') | content/public/common/url_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698