OLD | NEW |
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 "webkit/glue/webkitplatformsupport_impl.h" | 5 #include "webkit/glue/webkitplatformsupport_impl.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/allocator/allocator_extension.h" | 11 #include "base/allocator/allocator_extension.h" |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/debug/trace_event.h" | |
14 #include "base/memory/discardable_memory.h" | 13 #include "base/memory/discardable_memory.h" |
15 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/singleton.h" | 15 #include "base/memory/singleton.h" |
17 #include "base/message_loop.h" | 16 #include "base/message_loop.h" |
18 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
19 #include "base/metrics/stats_counters.h" | 18 #include "base/metrics/stats_counters.h" |
20 #include "base/platform_file.h" | 19 #include "base/platform_file.h" |
21 #include "base/process_util.h" | 20 #include "base/process_util.h" |
22 #include "base/rand_util.h" | 21 #include "base/rand_util.h" |
23 #include "base/string_number_conversions.h" | 22 #include "base/string_number_conversions.h" |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 boundary_value + 1, base::HistogramBase::kUmaTargetedHistogramFlag); | 445 boundary_value + 1, base::HistogramBase::kUmaTargetedHistogramFlag); |
447 DCHECK_EQ(name, counter->histogram_name()); | 446 DCHECK_EQ(name, counter->histogram_name()); |
448 counter->Add(sample); | 447 counter->Add(sample); |
449 } | 448 } |
450 | 449 |
451 const unsigned char* WebKitPlatformSupportImpl::getTraceCategoryEnabledFlag( | 450 const unsigned char* WebKitPlatformSupportImpl::getTraceCategoryEnabledFlag( |
452 const char* category_name) { | 451 const char* category_name) { |
453 return TRACE_EVENT_API_GET_CATEGORY_ENABLED(category_name); | 452 return TRACE_EVENT_API_GET_CATEGORY_ENABLED(category_name); |
454 } | 453 } |
455 | 454 |
| 455 long* WebKitPlatformSupportImpl::getTraceSamplingState( |
| 456 const unsigned thread_bucket) { |
| 457 switch(thread_bucket) { |
| 458 case 0: |
| 459 return reinterpret_cast<long*>(&TRACE_EVENT_API_THREAD_BUCKET(0)); |
| 460 case 1: |
| 461 return reinterpret_cast<long*>(&TRACE_EVENT_API_THREAD_BUCKET(1)); |
| 462 case 2: |
| 463 return reinterpret_cast<long*>(&TRACE_EVENT_API_THREAD_BUCKET(2)); |
| 464 default: |
| 465 NOTREACHED() << "Unknown thread bucket type."; |
| 466 } |
| 467 return NULL; |
| 468 } |
| 469 |
456 void WebKitPlatformSupportImpl::addTraceEvent( | 470 void WebKitPlatformSupportImpl::addTraceEvent( |
457 char phase, | 471 char phase, |
458 const unsigned char* category_enabled, | 472 const unsigned char* category_enabled, |
459 const char* name, | 473 const char* name, |
460 unsigned long long id, | 474 unsigned long long id, |
461 int num_args, | 475 int num_args, |
462 const char** arg_names, | 476 const char** arg_names, |
463 const unsigned char* arg_types, | 477 const unsigned char* arg_types, |
464 const unsigned long long* arg_values, | 478 const unsigned long long* arg_values, |
465 unsigned char flags) { | 479 unsigned char flags) { |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 return NULL; | 956 return NULL; |
943 scoped_ptr<WebDiscardableMemoryImpl> discardable( | 957 scoped_ptr<WebDiscardableMemoryImpl> discardable( |
944 new WebDiscardableMemoryImpl()); | 958 new WebDiscardableMemoryImpl()); |
945 if (discardable->InitializeAndLock(bytes)) | 959 if (discardable->InitializeAndLock(bytes)) |
946 return discardable.release(); | 960 return discardable.release(); |
947 return NULL; | 961 return NULL; |
948 } | 962 } |
949 | 963 |
950 | 964 |
951 } // namespace webkit_glue | 965 } // namespace webkit_glue |
OLD | NEW |