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

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

Issue 8919017: Split UserMetrics into API vs. implementation. Move API to content/public. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move to content namespace. Update usages. Update extract_actions tool. Created 9 years 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) 2011 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 // 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 #include "content/browser/renderer_host/render_view_host.h" 68 #include "content/browser/renderer_host/render_view_host.h"
69 #include "content/browser/renderer_host/render_view_host_delegate.h" 69 #include "content/browser/renderer_host/render_view_host_delegate.h"
70 #include "content/browser/renderer_host/render_widget_helper.h" 70 #include "content/browser/renderer_host/render_widget_helper.h"
71 #include "content/browser/renderer_host/render_widget_host.h" 71 #include "content/browser/renderer_host/render_widget_host.h"
72 #include "content/browser/renderer_host/resource_message_filter.h" 72 #include "content/browser/renderer_host/resource_message_filter.h"
73 #include "content/browser/renderer_host/socket_stream_dispatcher_host.h" 73 #include "content/browser/renderer_host/socket_stream_dispatcher_host.h"
74 #include "content/browser/renderer_host/text_input_client_message_filter.h" 74 #include "content/browser/renderer_host/text_input_client_message_filter.h"
75 #include "content/browser/resolve_proxy_msg_helper.h" 75 #include "content/browser/resolve_proxy_msg_helper.h"
76 #include "content/browser/speech/speech_input_dispatcher_host.h" 76 #include "content/browser/speech/speech_input_dispatcher_host.h"
77 #include "content/browser/trace_message_filter.h" 77 #include "content/browser/trace_message_filter.h"
78 #include "content/browser/user_metrics.h"
79 #include "content/browser/webui/web_ui_factory.h" 78 #include "content/browser/webui/web_ui_factory.h"
80 #include "content/browser/worker_host/worker_message_filter.h" 79 #include "content/browser/worker_host/worker_message_filter.h"
81 #include "content/common/child_process_host_impl.h" 80 #include "content/common/child_process_host_impl.h"
82 #include "content/common/child_process_messages.h" 81 #include "content/common/child_process_messages.h"
83 #include "content/common/gpu/gpu_messages.h" 82 #include "content/common/gpu/gpu_messages.h"
84 #include "content/public/browser/notification_service.h" 83 #include "content/public/browser/notification_service.h"
84 #include "content/public/browser/user_metrics.h"
85 #include "content/common/resource_messages.h" 85 #include "content/common/resource_messages.h"
86 #include "content/common/view_messages.h" 86 #include "content/common/view_messages.h"
87 #include "content/public/browser/content_browser_client.h" 87 #include "content/public/browser/content_browser_client.h"
88 #include "content/public/common/content_constants.h" 88 #include "content/public/common/content_constants.h"
89 #include "content/public/common/content_switches.h" 89 #include "content/public/common/content_switches.h"
90 #include "content/public/common/process_type.h" 90 #include "content/public/common/process_type.h"
91 #include "content/public/common/result_codes.h" 91 #include "content/public/common/result_codes.h"
92 #include "content/renderer/render_process_impl.h" 92 #include "content/renderer/render_process_impl.h"
93 #include "content/renderer/render_thread_impl.h" 93 #include "content/renderer/render_thread_impl.h"
94 #include "ipc/ipc_logging.h" 94 #include "ipc/ipc_logging.h"
(...skipping 12 matching lines...) Expand all
107 #include <objbase.h> 107 #include <objbase.h>
108 #include "base/synchronization/waitable_event.h" 108 #include "base/synchronization/waitable_event.h"
109 #include "content/common/font_cache_dispatcher_win.h" 109 #include "content/common/font_cache_dispatcher_win.h"
110 #endif 110 #endif
111 111
112 #include "third_party/skia/include/core/SkBitmap.h" 112 #include "third_party/skia/include/core/SkBitmap.h"
113 113
114 using content::BrowserThread; 114 using content::BrowserThread;
115 using content::ChildProcessHost; 115 using content::ChildProcessHost;
116 using content::ChildProcessHostImpl; 116 using content::ChildProcessHostImpl;
117 using content::UserMetricsAction;
117 118
118 // This class creates the IO thread for the renderer when running in 119 // This class creates the IO thread for the renderer when running in
119 // single-process mode. It's not used in multi-process mode. 120 // single-process mode. It's not used in multi-process mode.
120 class RendererMainThread : public base::Thread { 121 class RendererMainThread : public base::Thread {
121 public: 122 public:
122 explicit RendererMainThread(const std::string& channel_id) 123 explicit RendererMainThread(const std::string& channel_id)
123 : base::Thread("Chrome_InProcRendererThread"), 124 : base::Thread("Chrome_InProcRendererThread"),
124 channel_id_(channel_id), 125 channel_id_(channel_id),
125 render_process_(NULL) { 126 render_process_(NULL) {
126 } 127 }
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 OnUserMetricsRecordAction) 913 OnUserMetricsRecordAction)
913 IPC_MESSAGE_HANDLER(ViewHostMsg_RevealFolderInOS, OnRevealFolderInOS) 914 IPC_MESSAGE_HANDLER(ViewHostMsg_RevealFolderInOS, OnRevealFolderInOS)
914 IPC_MESSAGE_HANDLER(ViewHostMsg_SavedPageAsMHTML, OnSavedPageAsMHTML) 915 IPC_MESSAGE_HANDLER(ViewHostMsg_SavedPageAsMHTML, OnSavedPageAsMHTML)
915 IPC_MESSAGE_UNHANDLED_ERROR() 916 IPC_MESSAGE_UNHANDLED_ERROR()
916 IPC_END_MESSAGE_MAP_EX() 917 IPC_END_MESSAGE_MAP_EX()
917 918
918 if (!msg_is_ok) { 919 if (!msg_is_ok) {
919 // The message had a handler, but its de-serialization failed. 920 // The message had a handler, but its de-serialization failed.
920 // We consider this a capital crime. Kill the renderer if we have one. 921 // We consider this a capital crime. Kill the renderer if we have one.
921 LOG(ERROR) << "bad message " << msg.type() << " terminating renderer."; 922 LOG(ERROR) << "bad message " << msg.type() << " terminating renderer.";
922 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_BRPH")); 923 content::RecordAction(UserMetricsAction("BadMessageTerminate_BRPH"));
923 ReceivedBadMessage(); 924 ReceivedBadMessage();
924 } 925 }
925 return true; 926 return true;
926 } 927 }
927 928
928 // Dispatch incoming messages to the appropriate RenderView/WidgetHost. 929 // Dispatch incoming messages to the appropriate RenderView/WidgetHost.
929 IPC::Channel::Listener* listener = GetListenerByID(msg.routing_id()); 930 IPC::Channel::Listener* listener = GetListenerByID(msg.routing_id());
930 if (!listener) { 931 if (!listener) {
931 if (msg.is_sync()) { 932 if (msg.is_sync()) {
932 // The listener has gone away, so we must respond or else the caller will 933 // The listener has gone away, so we must respond or else the caller will
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
1309 content::NotificationService::NoDetails()); 1310 content::NotificationService::NoDetails());
1310 1311
1311 while (!queued_messages_.empty()) { 1312 while (!queued_messages_.empty()) {
1312 Send(queued_messages_.front()); 1313 Send(queued_messages_.front());
1313 queued_messages_.pop(); 1314 queued_messages_.pop();
1314 } 1315 }
1315 } 1316 }
1316 1317
1317 void RenderProcessHostImpl::OnUserMetricsRecordAction( 1318 void RenderProcessHostImpl::OnUserMetricsRecordAction(
1318 const std::string& action) { 1319 const std::string& action) {
1319 UserMetrics::RecordComputedAction(action); 1320 content::RecordComputedAction(action);
1320 } 1321 }
1321 1322
1322 void RenderProcessHostImpl::OnRevealFolderInOS(const FilePath& path) { 1323 void RenderProcessHostImpl::OnRevealFolderInOS(const FilePath& path) {
1323 // Only honor the request if appropriate persmissions are granted. 1324 // Only honor the request if appropriate persmissions are granted.
1324 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(GetID(), path)) 1325 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(GetID(), path))
1325 content::GetContentClient()->browser()->OpenItem(path); 1326 content::GetContentClient()->browser()->OpenItem(path);
1326 } 1327 }
1327 1328
1328 void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) { 1329 void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) {
1329 content::GetContentClient()->browser()->GetMHTMLGenerationManager()-> 1330 content::GetContentClient()->browser()->GetMHTMLGenerationManager()->
1330 MHTMLGenerated(job_id, data_size); 1331 MHTMLGenerated(job_id, data_size);
1331 } 1332 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698