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

Side by Side Diff: webkit/glue/webkitplatformsupport_impl.cc

Issue 12316146: Expose global state variables for sampling tracing to WebKit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed return types Created 7 years, 9 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
« no previous file with comments | « webkit/glue/webkitplatformsupport_impl.h ('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 "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
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
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
OLDNEW
« no previous file with comments | « webkit/glue/webkitplatformsupport_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698