| 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 |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 // Copied from histogram macro, but without the static variable caching | 441 // Copied from histogram macro, but without the static variable caching |
| 442 // the histogram because name is dynamic. | 442 // the histogram because name is dynamic. |
| 443 base::HistogramBase* counter = | 443 base::HistogramBase* counter = |
| 444 base::LinearHistogram::FactoryGet(name, 1, boundary_value, | 444 base::LinearHistogram::FactoryGet(name, 1, boundary_value, |
| 445 boundary_value + 1, base::HistogramBase::kUmaTargetedHistogramFlag); | 445 boundary_value + 1, base::HistogramBase::kUmaTargetedHistogramFlag); |
| 446 DCHECK_EQ(name, counter->histogram_name()); | 446 DCHECK_EQ(name, counter->histogram_name()); |
| 447 counter->Add(sample); | 447 counter->Add(sample); |
| 448 } | 448 } |
| 449 | 449 |
| 450 const unsigned char* WebKitPlatformSupportImpl::getTraceCategoryEnabledFlag( | 450 const unsigned char* WebKitPlatformSupportImpl::getTraceCategoryEnabledFlag( |
| 451 const char* category_name) { | 451 const char* category_group) { |
| 452 return TRACE_EVENT_API_GET_CATEGORY_ENABLED(category_name); | 452 return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_group); |
| 453 } | 453 } |
| 454 | 454 |
| 455 long* WebKitPlatformSupportImpl::getTraceSamplingState( | 455 long* WebKitPlatformSupportImpl::getTraceSamplingState( |
| 456 const unsigned thread_bucket) { | 456 const unsigned thread_bucket) { |
| 457 switch(thread_bucket) { | 457 switch(thread_bucket) { |
| 458 case 0: | 458 case 0: |
| 459 return reinterpret_cast<long*>(&TRACE_EVENT_API_THREAD_BUCKET(0)); | 459 return reinterpret_cast<long*>(&TRACE_EVENT_API_THREAD_BUCKET(0)); |
| 460 case 1: | 460 case 1: |
| 461 return reinterpret_cast<long*>(&TRACE_EVENT_API_THREAD_BUCKET(1)); | 461 return reinterpret_cast<long*>(&TRACE_EVENT_API_THREAD_BUCKET(1)); |
| 462 case 2: | 462 case 2: |
| 463 return reinterpret_cast<long*>(&TRACE_EVENT_API_THREAD_BUCKET(2)); | 463 return reinterpret_cast<long*>(&TRACE_EVENT_API_THREAD_BUCKET(2)); |
| 464 default: | 464 default: |
| 465 NOTREACHED() << "Unknown thread bucket type."; | 465 NOTREACHED() << "Unknown thread bucket type."; |
| 466 } | 466 } |
| 467 return NULL; | 467 return NULL; |
| 468 } | 468 } |
| 469 | 469 |
| 470 void WebKitPlatformSupportImpl::addTraceEvent( | 470 void WebKitPlatformSupportImpl::addTraceEvent( |
| 471 char phase, | 471 char phase, |
| 472 const unsigned char* category_enabled, | 472 const unsigned char* category_group_enabled, |
| 473 const char* name, | 473 const char* name, |
| 474 unsigned long long id, | 474 unsigned long long id, |
| 475 int num_args, | 475 int num_args, |
| 476 const char** arg_names, | 476 const char** arg_names, |
| 477 const unsigned char* arg_types, | 477 const unsigned char* arg_types, |
| 478 const unsigned long long* arg_values, | 478 const unsigned long long* arg_values, |
| 479 unsigned char flags) { | 479 unsigned char flags) { |
| 480 TRACE_EVENT_API_ADD_TRACE_EVENT(phase, category_enabled, name, id, | 480 TRACE_EVENT_API_ADD_TRACE_EVENT(phase, category_group_enabled, name, id, |
| 481 num_args, arg_names, arg_types, | 481 num_args, arg_names, arg_types, |
| 482 arg_values, flags); | 482 arg_values, flags); |
| 483 } | 483 } |
| 484 | 484 |
| 485 | 485 |
| 486 namespace { | 486 namespace { |
| 487 | 487 |
| 488 WebData loadAudioSpatializationResource(WebKitPlatformSupportImpl* platform, | 488 WebData loadAudioSpatializationResource(WebKitPlatformSupportImpl* platform, |
| 489 const char* name) { | 489 const char* name) { |
| 490 #ifdef IDR_AUDIO_SPATIALIZATION_T000_P000 | 490 #ifdef IDR_AUDIO_SPATIALIZATION_T000_P000 |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 956 return NULL; | 956 return NULL; |
| 957 scoped_ptr<WebDiscardableMemoryImpl> discardable( | 957 scoped_ptr<WebDiscardableMemoryImpl> discardable( |
| 958 new WebDiscardableMemoryImpl()); | 958 new WebDiscardableMemoryImpl()); |
| 959 if (discardable->InitializeAndLock(bytes)) | 959 if (discardable->InitializeAndLock(bytes)) |
| 960 return discardable.release(); | 960 return discardable.release(); |
| 961 return NULL; | 961 return NULL; |
| 962 } | 962 } |
| 963 | 963 |
| 964 | 964 |
| 965 } // namespace webkit_glue | 965 } // namespace webkit_glue |
| OLD | NEW |