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

Side by Side Diff: content/browser/gpu/browser_gpu_channel_host_factory.cc

Issue 445413003: Creating a framework for suppressing pollution of the profiler data (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More jar@ comments Created 6 years, 3 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
« base/tracked_objects.cc ('K') | « base/tracked_objects_unittest.cc ('k') | no next file » | 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/browser/gpu/browser_gpu_channel_host_factory.h" 5 #include "content/browser/gpu/browser_gpu_channel_host_factory.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "base/threading/thread_restrictions.h" 10 #include "base/threading/thread_restrictions.h"
11 #include "base/tracked_objects.h"
11 #include "content/browser/gpu/gpu_data_manager_impl.h" 12 #include "content/browser/gpu/gpu_data_manager_impl.h"
12 #include "content/browser/gpu/gpu_process_host.h" 13 #include "content/browser/gpu/gpu_process_host.h"
13 #include "content/browser/gpu/gpu_surface_tracker.h" 14 #include "content/browser/gpu/gpu_surface_tracker.h"
14 #include "content/common/child_process_host_impl.h" 15 #include "content/common/child_process_host_impl.h"
15 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" 16 #include "content/common/gpu/client/gpu_memory_buffer_impl.h"
16 #include "content/common/gpu/gpu_messages.h" 17 #include "content/common/gpu/gpu_messages.h"
17 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
18 #include "content/public/browser/gpu_data_manager.h" 19 #include "content/public/browser/gpu_data_manager.h"
19 #include "content/public/common/content_client.h" 20 #include "content/public/common/content_client.h"
20 #include "ipc/ipc_channel_handle.h" 21 #include "ipc/ipc_channel_handle.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 BrowserGpuChannelHostFactory* factory = 163 BrowserGpuChannelHostFactory* factory =
163 BrowserGpuChannelHostFactory::instance(); 164 BrowserGpuChannelHostFactory::instance();
164 factory->GpuChannelEstablished(); 165 factory->GpuChannelEstablished();
165 finished_ = true; 166 finished_ = true;
166 } 167 }
167 } 168 }
168 169
169 void BrowserGpuChannelHostFactory::EstablishRequest::Wait() { 170 void BrowserGpuChannelHostFactory::EstablishRequest::Wait() {
170 DCHECK(main_loop_->BelongsToCurrentThread()); 171 DCHECK(main_loop_->BelongsToCurrentThread());
171 { 172 {
173 // Since the current task synchronously waits for establishing a GPU
174 // channel, it shouldn't be tallied because its execution time has nothing
175 // to do with its efficiency. Using task stopwatch to exclude the waiting
176 // time from the current task run time.
177 tracked_objects::TaskStopwatch stopwatch;
172 // We're blocking the UI thread, which is generally undesirable. 178 // We're blocking the UI thread, which is generally undesirable.
173 // In this case we need to wait for this before we can show any UI 179 // In this case we need to wait for this before we can show any UI
174 // /anyway/, so it won't cause additional jank. 180 // /anyway/, so it won't cause additional jank.
175 // TODO(piman): Make this asynchronous (http://crbug.com/125248). 181 // TODO(piman): Make this asynchronous (http://crbug.com/125248).
176 TRACE_EVENT0("browser", 182 TRACE_EVENT0("browser",
177 "BrowserGpuChannelHostFactory::EstablishGpuChannelSync"); 183 "BrowserGpuChannelHostFactory::EstablishGpuChannelSync");
178 base::ThreadRestrictions::ScopedAllowWait allow_wait; 184 base::ThreadRestrictions::ScopedAllowWait allow_wait;
179 event_.Wait(); 185 event_.Wait();
186
187 stopwatch.Stop();
180 } 188 }
181 FinishOnMain(); 189 FinishOnMain();
182 } 190 }
183 191
184 void BrowserGpuChannelHostFactory::EstablishRequest::Cancel() { 192 void BrowserGpuChannelHostFactory::EstablishRequest::Cancel() {
185 DCHECK(main_loop_->BelongsToCurrentThread()); 193 DCHECK(main_loop_->BelongsToCurrentThread());
186 finished_ = true; 194 finished_ = true;
187 } 195 }
188 196
189 bool BrowserGpuChannelHostFactory::CanUseForTesting() { 197 bool BrowserGpuChannelHostFactory::CanUseForTesting() {
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 filter->AddRoute(MSG_ROUTING_CONTROL, handler); 471 filter->AddRoute(MSG_ROUTING_CONTROL, handler);
464 472
465 GetIOLoopProxy()->PostTask( 473 GetIOLoopProxy()->PostTask(
466 FROM_HERE, 474 FROM_HERE,
467 base::Bind(&BrowserGpuChannelHostFactory::AddFilterOnIO, 475 base::Bind(&BrowserGpuChannelHostFactory::AddFilterOnIO,
468 gpu_host_id_, 476 gpu_host_id_,
469 filter)); 477 filter));
470 } 478 }
471 479
472 } // namespace content 480 } // namespace content
OLDNEW
« base/tracked_objects.cc ('K') | « base/tracked_objects_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698