OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/child/blink_platform_impl.h" | 5 #include "content/child/blink_platform_impl.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 static_assert( | 618 static_assert( |
619 sizeof(blink::Platform::TraceEventHandle) == | 619 sizeof(blink::Platform::TraceEventHandle) == |
620 sizeof(base::trace_event::TraceEventHandle), | 620 sizeof(base::trace_event::TraceEventHandle), |
621 "TraceEventHandle types must be same size"); | 621 "TraceEventHandle types must be same size"); |
622 | 622 |
623 blink::Platform::TraceEventHandle BlinkPlatformImpl::addTraceEvent( | 623 blink::Platform::TraceEventHandle BlinkPlatformImpl::addTraceEvent( |
624 char phase, | 624 char phase, |
625 const unsigned char* category_group_enabled, | 625 const unsigned char* category_group_enabled, |
626 const char* name, | 626 const char* name, |
627 unsigned long long id, | 627 unsigned long long id, |
| 628 unsigned long long bind_id, |
628 double timestamp, | 629 double timestamp, |
629 int num_args, | 630 int num_args, |
630 const char** arg_names, | 631 const char** arg_names, |
631 const unsigned char* arg_types, | 632 const unsigned char* arg_types, |
632 const unsigned long long* arg_values, | 633 const unsigned long long* arg_values, |
633 unsigned char flags) { | 634 blink::WebConvertableToTraceFormat* convertable_values, |
| 635 unsigned int flags) { |
| 636 scoped_refptr<base::trace_event::ConvertableToTraceFormat> |
| 637 convertable_wrappers[2]; |
| 638 if (convertable_values) { |
| 639 size_t size = std::min(static_cast<size_t>(num_args), |
| 640 arraysize(convertable_wrappers)); |
| 641 for (size_t i = 0; i < size; ++i) { |
| 642 if (arg_types[i] == TRACE_VALUE_TYPE_CONVERTABLE) { |
| 643 convertable_wrappers[i] = |
| 644 new ConvertableToTraceFormatWrapper(convertable_values[i]); |
| 645 } |
| 646 } |
| 647 } |
634 base::TraceTicks timestamp_tt = | 648 base::TraceTicks timestamp_tt = |
635 base::TraceTicks() + base::TimeDelta::FromSecondsD(timestamp); | 649 base::TraceTicks() + base::TimeDelta::FromSecondsD(timestamp); |
636 base::trace_event::TraceEventHandle handle = | 650 base::trace_event::TraceEventHandle handle = |
637 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( | 651 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( |
638 phase, category_group_enabled, name, id, trace_event_internal::kNoId, | 652 phase, category_group_enabled, name, id, trace_event_internal::kNoId, |
639 base::PlatformThread::CurrentId(), timestamp_tt, num_args, arg_names, | 653 base::PlatformThread::CurrentId(), bind_id, timestamp_tt, num_args, |
640 arg_types, arg_values, NULL, flags); | 654 arg_names, arg_types, arg_values, convertable_wrappers, flags); |
641 blink::Platform::TraceEventHandle result; | 655 blink::Platform::TraceEventHandle result; |
642 memcpy(&result, &handle, sizeof(result)); | 656 memcpy(&result, &handle, sizeof(result)); |
643 return result; | 657 return result; |
644 } | 658 } |
645 | 659 |
646 blink::Platform::TraceEventHandle BlinkPlatformImpl::addTraceEvent( | 660 blink::Platform::TraceEventHandle BlinkPlatformImpl::addTraceEvent( |
647 char phase, | 661 char phase, |
648 const unsigned char* category_group_enabled, | 662 const unsigned char* category_group_enabled, |
649 const char* name, | 663 const char* name, |
650 unsigned long long id, | 664 unsigned long long id, |
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1368 return WebString::fromUTF8(ui::KeycodeConverter::DomCodeToCodeString( | 1382 return WebString::fromUTF8(ui::KeycodeConverter::DomCodeToCodeString( |
1369 static_cast<ui::DomCode>(dom_code))); | 1383 static_cast<ui::DomCode>(dom_code))); |
1370 } | 1384 } |
1371 | 1385 |
1372 int BlinkPlatformImpl::domEnumFromCodeString(const WebString& code) { | 1386 int BlinkPlatformImpl::domEnumFromCodeString(const WebString& code) { |
1373 return static_cast<int>(ui::KeycodeConverter::CodeStringToDomCode( | 1387 return static_cast<int>(ui::KeycodeConverter::CodeStringToDomCode( |
1374 code.utf8().data())); | 1388 code.utf8().data())); |
1375 } | 1389 } |
1376 | 1390 |
1377 } // namespace content | 1391 } // namespace content |
OLD | NEW |