OLD | NEW |
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 #include "webkit/glue/webkitclient_impl.h" | 5 #include "webkit/glue/webkitclient_impl.h" |
6 | 6 |
7 #if defined(OS_LINUX) | 7 #if defined(OS_LINUX) |
8 #include <malloc.h> | 8 #include <malloc.h> |
9 #endif | 9 #endif |
10 | 10 |
11 #include <math.h> | 11 #include <math.h> |
12 | 12 |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/debug/trace_event.h" | 15 #include "base/debug/trace_event.h" |
16 #include "base/memory/singleton.h" | 16 #include "base/memory/singleton.h" |
17 #include "base/message_loop.h" | 17 #include "base/message_loop.h" |
18 #include "base/metrics/histogram.h" | 18 #include "base/metrics/histogram.h" |
19 #include "base/metrics/stats_counters.h" | 19 #include "base/metrics/stats_counters.h" |
20 #include "base/platform_file.h" | 20 #include "base/platform_file.h" |
21 #include "base/process_util.h" | 21 #include "base/process_util.h" |
22 #include "base/rand_util.h" | 22 #include "base/rand_util.h" |
23 #include "base/string_number_conversions.h" | 23 #include "base/string_number_conversions.h" |
24 #include "base/string_util.h" | 24 #include "base/string_util.h" |
25 #include "base/synchronization/lock.h" | 25 #include "base/synchronization/lock.h" |
26 #include "base/time.h" | 26 #include "base/time.h" |
27 #include "base/utf_string_conversions.h" | 27 #include "base/utf_string_conversions.h" |
28 #include "gpu/common/gpu_trace_event.h" | |
29 #include "grit/webkit_chromium_resources.h" | 28 #include "grit/webkit_chromium_resources.h" |
30 #include "grit/webkit_resources.h" | 29 #include "grit/webkit_resources.h" |
31 #include "grit/webkit_strings.h" | 30 #include "grit/webkit_strings.h" |
32 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCookie.h" | 31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCookie.h" |
33 #include "third_party/WebKit/Source/WebKit/chromium/public/WebData.h" | 32 #include "third_party/WebKit/Source/WebKit/chromium/public/WebData.h" |
34 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrameClient.h" | 33 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrameClient.h" |
35 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginListBuilder.
h" | 34 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginListBuilder.
h" |
36 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" | 35 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" |
37 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" | 36 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
38 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h" | 37 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h" |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 // the histogram because name is dynamic. | 276 // the histogram because name is dynamic. |
278 base::Histogram* counter = | 277 base::Histogram* counter = |
279 base::LinearHistogram::FactoryGet(name, 1, boundary_value, | 278 base::LinearHistogram::FactoryGet(name, 1, boundary_value, |
280 boundary_value + 1, base::Histogram::kUmaTargetedHistogramFlag); | 279 boundary_value + 1, base::Histogram::kUmaTargetedHistogramFlag); |
281 DCHECK_EQ(name, counter->histogram_name()); | 280 DCHECK_EQ(name, counter->histogram_name()); |
282 counter->Add(sample); | 281 counter->Add(sample); |
283 } | 282 } |
284 | 283 |
285 void WebKitClientImpl::traceEventBegin(const char* name, void* id, | 284 void WebKitClientImpl::traceEventBegin(const char* name, void* id, |
286 const char* extra) { | 285 const char* extra) { |
287 TRACE_EVENT_BEGIN(name, id, extra); | 286 TRACE_EVENT_BEGIN_ETW(name, id, extra); |
288 GPU_TRACE_EVENT_BEGIN2("webkit", name, | |
289 "id", id, | |
290 "extra", extra ? extra : ""); | |
291 } | 287 } |
292 | 288 |
293 void WebKitClientImpl::traceEventEnd(const char* name, void* id, | 289 void WebKitClientImpl::traceEventEnd(const char* name, void* id, |
294 const char* extra) { | 290 const char* extra) { |
295 TRACE_EVENT_END(name, id, extra); | 291 TRACE_EVENT_END_ETW(name, id, extra); |
296 GPU_TRACE_EVENT_END0("webkit", name); | |
297 } | 292 } |
298 | 293 |
299 namespace { | 294 namespace { |
300 | 295 |
301 WebData loadAudioSpatializationResource(const char* name) { | 296 WebData loadAudioSpatializationResource(const char* name) { |
302 #ifdef IDR_AUDIO_SPATIALIZATION_T000_P000 | 297 #ifdef IDR_AUDIO_SPATIALIZATION_T000_P000 |
303 const size_t kExpectedSpatializationNameLength = 31; | 298 const size_t kExpectedSpatializationNameLength = 31; |
304 if (strlen(name) != kExpectedSpatializationNameLength) { | 299 if (strlen(name) != kExpectedSpatializationNameLength) { |
305 return WebData(); | 300 return WebData(); |
306 } | 301 } |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 ++shared_timer_suspended_; | 591 ++shared_timer_suspended_; |
597 } | 592 } |
598 | 593 |
599 void WebKitClientImpl::ResumeSharedTimer() { | 594 void WebKitClientImpl::ResumeSharedTimer() { |
600 // The shared timer may have fired or been adjusted while we were suspended. | 595 // The shared timer may have fired or been adjusted while we were suspended. |
601 if (--shared_timer_suspended_ == 0 && !shared_timer_.IsRunning()) | 596 if (--shared_timer_suspended_ == 0 && !shared_timer_.IsRunning()) |
602 setSharedTimerFireTime(shared_timer_fire_time_); | 597 setSharedTimerFireTime(shared_timer_fire_time_); |
603 } | 598 } |
604 | 599 |
605 } // namespace webkit_glue | 600 } // namespace webkit_glue |
OLD | NEW |