| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "InternalProfilers.h" | 32 #include "InternalProfilers.h" |
| 33 | 33 |
| 34 #include "public/platform/Platform.h" | 34 #include "public/platform/Platform.h" |
| 35 #include "wtf/text/CString.h" | 35 #include "wtf/text/CString.h" |
| 36 #include "wtf/text/WTFString.h" | 36 #include "wtf/text/WTFString.h" |
| 37 #include <algorithm> | 37 #include <algorithm> |
| 38 | 38 |
| 39 namespace WebCore { | 39 namespace WebCore { |
| 40 | 40 |
| 41 DEFINE_GC_INFO(InternalProfilers); | |
| 42 | |
| 43 void InternalProfilers::startHeapProfiling(const String& prefix) | 41 void InternalProfilers::startHeapProfiling(const String& prefix) |
| 44 { | 42 { |
| 45 blink::Platform::current()->startHeapProfiling(prefix); | 43 blink::Platform::current()->startHeapProfiling(prefix); |
| 46 } | 44 } |
| 47 | 45 |
| 48 void InternalProfilers::stopHeapProfiling() | 46 void InternalProfilers::stopHeapProfiling() |
| 49 { | 47 { |
| 50 blink::Platform::current()->stopHeapProfiling(); | 48 blink::Platform::current()->stopHeapProfiling(); |
| 51 } | 49 } |
| 52 | 50 |
| 53 void InternalProfilers::dumpHeapProfiling(const String& reason) | 51 void InternalProfilers::dumpHeapProfiling(const String& reason) |
| 54 { | 52 { |
| 55 blink::Platform::current()->dumpHeapProfiling(reason); | 53 blink::Platform::current()->dumpHeapProfiling(reason); |
| 56 } | 54 } |
| 57 | 55 |
| 58 String InternalProfilers::getHeapProfile() | 56 String InternalProfilers::getHeapProfile() |
| 59 { | 57 { |
| 60 String text = blink::Platform::current()->getHeapProfile(); | 58 String text = blink::Platform::current()->getHeapProfile(); |
| 61 // Only return the first line which contains total numbers | 59 // Only return the first line which contains total numbers |
| 62 // because whole dump is too big and too noisy to process in JavaScript. | 60 // because whole dump is too big and too noisy to process in JavaScript. |
| 63 return text.substring(0, text.find('\n')); | 61 return text.substring(0, text.find('\n')); |
| 64 } | 62 } |
| 65 | 63 |
| 66 } | 64 } |
| OLD | NEW |