Reviewers: alph, loislo, Sven Panne,

Description:
StopCpuProfiling should return non-const CpuProfile

StopCpuProfiling is replaced with StopProfiling which returns non-const
CpuProfile which allows to call CpuProfile::Delete on it without const_cast.
Also replaced StartCpuProfiling with StartProfiling to have symmetric names for
start/stop actions.

BUG=v8:3213
LOG=Y

Please review this at https://codereview.chromium.org/197873015/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+19, -3 lines):
  M include/v8-profiler.h
  M src/api.cc


Index: include/v8-profiler.h
diff --git a/include/v8-profiler.h b/include/v8-profiler.h
index 59c2d5dacdb13eb390cd6e266957398336a5d553..257ec71fe2b6e6b0e1ddd91ce2bfffd1e2a0891e 100644
--- a/include/v8-profiler.h
+++ b/include/v8-profiler.h
@@ -158,12 +158,18 @@ class V8_EXPORT CpuProfiler {
    * |record_samples| parameter controls whether individual samples should
    * be recorded in addition to the aggregated tree.
    */
+  void StartProfiling(Handle<String> title, bool record_samples = false);
+
+  /** Deprecated. Use StartProfiling instead. */
void StartCpuProfiling(Handle<String> title, bool record_samples = false);

   /**
    * Stops collecting CPU profile with a given title and returns it.
    * If the title given is empty, finishes the last profile started.
    */
+  CpuProfile* StopProfiling(Handle<String> title);
+
+  /** Deprecated. Use StopProfiling instead. */
   const CpuProfile* StopCpuProfiling(Handle<String> title);

   /**
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index fe43c4d6269a66fbb0db610072edb2ccdc800710..8269fd9fd7057765a92bb89a0e9627425b460aba 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -6956,19 +6956,29 @@ void CpuProfiler::SetSamplingInterval(int us) {
 }


-void CpuProfiler::StartCpuProfiling(Handle<String> title, bool record_samples) { +void CpuProfiler::StartProfiling(Handle<String> title, bool record_samples) {
   reinterpret_cast<i::CpuProfiler*>(this)->StartProfiling(
       *Utils::OpenHandle(*title), record_samples);
 }


-const CpuProfile* CpuProfiler::StopCpuProfiling(Handle<String> title) {
-  return reinterpret_cast<const CpuProfile*>(
+void CpuProfiler::StartCpuProfiling(Handle<String> title, bool record_samples) {
+  StartProfiling(title, record_samples);
+}
+
+
+CpuProfile* CpuProfiler::StopProfiling(Handle<String> title) {
+  return reinterpret_cast<CpuProfile*>(
       reinterpret_cast<i::CpuProfiler*>(this)->StopProfiling(
           *Utils::OpenHandle(*title)));
 }


+const CpuProfile* CpuProfiler::StopCpuProfiling(Handle<String> title) {
+  return StopProfiling(title);
+}
+
+
 void CpuProfiler::SetIdle(bool is_idle) {
   i::Isolate* isolate = reinterpret_cast<i::CpuProfiler*>(this)->isolate();
   i::StateTag state = isolate->current_vm_state();


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to