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

Side by Side Diff: content/renderer/renderer_webkitplatformsupport_impl.cc

Issue 10451076: Adding UMA for sync IPCs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: histogram Created 8 years, 6 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/renderer/renderer_webkitplatformsupport_impl.h" 5 #include "content/renderer/renderer_webkitplatformsupport_impl.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/platform_file.h" 10 #include "base/platform_file.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 sandbox_support_(new RendererWebKitPlatformSupportImpl::SandboxSupport), 166 sandbox_support_(new RendererWebKitPlatformSupportImpl::SandboxSupport),
167 sudden_termination_disables_(0), 167 sudden_termination_disables_(0),
168 shared_worker_repository_(new WebSharedWorkerRepositoryImpl) { 168 shared_worker_repository_(new WebSharedWorkerRepositoryImpl) {
169 } 169 }
170 170
171 RendererWebKitPlatformSupportImpl::~RendererWebKitPlatformSupportImpl() { 171 RendererWebKitPlatformSupportImpl::~RendererWebKitPlatformSupportImpl() {
172 } 172 }
173 173
174 //------------------------------------------------------------------------------ 174 //------------------------------------------------------------------------------
175 175
176 namespace {
177
178 bool SendSyncMessageFromAnyThreadInternal(IPC::SyncMessage* msg) {
179 RenderThreadImpl* render_thread = RenderThreadImpl::current();
180 if (render_thread)
181 return render_thread->Send(msg);
182 scoped_refptr<IPC::SyncMessageFilter> sync_msg_filter(
183 ChildThread::current()->sync_message_filter());
184 return sync_msg_filter->Send(msg);
185 }
186
187 bool SendSyncMessageFromAnyThread(IPC::SyncMessage* msg) {
188 base::TimeTicks begin = base::TimeTicks::Now();
189 const bool success = SendSyncMessageFromAnyThread(msg);
190 base::TimeDelta delta = base::TimeTicks::Now() - begin;
191 ChildThread::current()->Send(new ViewHostMsg_SyncIPCElapsedTime(delta));
jam 2012/05/31 15:20:16 you can histogram from the renderer, just call HIS
kinuko 2012/05/31 17:10:36 oooops... (ashamed) done.
192 return success;
193 }
194
195 } // namespace
196
176 WebKit::WebClipboard* RendererWebKitPlatformSupportImpl::clipboard() { 197 WebKit::WebClipboard* RendererWebKitPlatformSupportImpl::clipboard() {
177 return clipboard_.get(); 198 return clipboard_.get();
178 } 199 }
179 200
180 WebKit::WebMimeRegistry* RendererWebKitPlatformSupportImpl::mimeRegistry() { 201 WebKit::WebMimeRegistry* RendererWebKitPlatformSupportImpl::mimeRegistry() {
181 return mime_registry_.get(); 202 return mime_registry_.get();
182 } 203 }
183 204
184 WebKit::WebFileUtilities* 205 WebKit::WebFileUtilities*
185 RendererWebKitPlatformSupportImpl::fileUtilities() { 206 RendererWebKitPlatformSupportImpl::fileUtilities() {
(...skipping 22 matching lines...) Expand all
208 // As explained in WebKitPlatformSupport.h, this function is used to decide 229 // As explained in WebKitPlatformSupport.h, this function is used to decide
209 // whether to allow file system operations to come out of WebKit or not. 230 // whether to allow file system operations to come out of WebKit or not.
210 // Even if the sandbox is disabled, there's no reason why the code should 231 // Even if the sandbox is disabled, there's no reason why the code should
211 // act any differently...unless we're in single process mode. In which 232 // act any differently...unless we're in single process mode. In which
212 // case, we have no other choice. WebKitPlatformSupport.h discourages using 233 // case, we have no other choice. WebKitPlatformSupport.h discourages using
213 // this switch unless absolutely necessary, so hopefully we won't end up 234 // this switch unless absolutely necessary, so hopefully we won't end up
214 // with too many code paths being different in single-process mode. 235 // with too many code paths being different in single-process mode.
215 return !CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess); 236 return !CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess);
216 } 237 }
217 238
218 bool RendererWebKitPlatformSupportImpl::SendSyncMessageFromAnyThread(
219 IPC::SyncMessage* msg) {
220 RenderThreadImpl* render_thread = RenderThreadImpl::current();
221 if (render_thread)
222 return render_thread->Send(msg);
223
224 scoped_refptr<IPC::SyncMessageFilter> sync_msg_filter(
225 ChildThread::current()->sync_message_filter());
226 return sync_msg_filter->Send(msg);
227 }
228
229 unsigned long long RendererWebKitPlatformSupportImpl::visitedLinkHash( 239 unsigned long long RendererWebKitPlatformSupportImpl::visitedLinkHash(
230 const char* canonical_url, 240 const char* canonical_url,
231 size_t length) { 241 size_t length) {
232 return content::GetContentClient()->renderer()->VisitedLinkHash( 242 return content::GetContentClient()->renderer()->VisitedLinkHash(
233 canonical_url, length); 243 canonical_url, length);
234 } 244 }
235 245
236 bool RendererWebKitPlatformSupportImpl::isLinkVisited( 246 bool RendererWebKitPlatformSupportImpl::isLinkVisited(
237 unsigned long long link_hash) { 247 unsigned long long link_hash) {
238 return content::GetContentClient()->renderer()->IsLinkVisited(link_hash); 248 return content::GetContentClient()->renderer()->IsLinkVisited(link_hash);
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 DCHECK(render_thread); 714 DCHECK(render_thread);
705 if (!render_thread) 715 if (!render_thread)
706 return NULL; 716 return NULL;
707 return render_thread->CreateMediaStreamCenter(client); 717 return render_thread->CreateMediaStreamCenter(client);
708 } 718 }
709 719
710 GpuChannelHostFactory* 720 GpuChannelHostFactory*
711 RendererWebKitPlatformSupportImpl::GetGpuChannelHostFactory() { 721 RendererWebKitPlatformSupportImpl::GetGpuChannelHostFactory() {
712 return RenderThreadImpl::current(); 722 return RenderThreadImpl::current();
713 } 723 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698