[Telemetry] Remove custom destructor from AppBackend

Closing the backend in the destructor is
1) Redundant since the backend is being closed from Browser.close()
2) Dangerous since it can happen at any moment due to garbage collection
and cause deadlocks in tracing code (see the bug).

Bug: chromium:1227504
Change-Id: I518eb7153c8929117715834b60bc08c413883866
Reviewed-on: https://chromium-review.googlesource.com/c/catapult/+/3015685
Auto-Submit: Mikhail Khokhlov <26a5474f563e73cb4d4e9a12e954c50f60aae4c8@google.com>
Reviewed-by: Wenbin Zhang <45ad8a1ff616a38a2202fd35571df81897c5f14f@google.com>
Commit-Queue: Wenbin Zhang <45ad8a1ff616a38a2202fd35571df81897c5f14f@google.com>
# Copyright 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

from __future__ import absolute_import
import six

from py_trace_event import trace_event


class AppBackend(six.with_metaclass(trace_event.TracedMetaClass, object)):

  def __init__(self, app_type, platform_backend):
    super(AppBackend, self).__init__()
    self._app = None
    self._app_type = app_type
    self._platform_backend = platform_backend

  def SetApp(self, app):
    self._app = app

  @property
  def app(self):
    return self._app

  @property
  def app_type(self):
    return self._app_type

  @property
  def platform_backend(self):
    return self._platform_backend

  def Foreground(self):
    # TODO(catapult:#2194): Remove the unnecessary pass below when the method
    # has been implemented on all concrete subclasses.
    pass  # pylint: disable=unnecessary-pass
    raise NotImplementedError

  def Background(self):
    raise NotImplementedError

  def Close(self):
    raise NotImplementedError

  def IsAppRunning(self):
    raise NotImplementedError

# Copyright 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

from __future__ import absolute_import
import six

from py_trace_event import trace_event


class AppBackend(six.with_metaclass(trace_event.TracedMetaClass, object)):

  def __init__(self, app_type, platform_backend):
    super(AppBackend, self).__init__()
    self._app = None
    self._app_type = app_type
    self._platform_backend = platform_backend

  def __del__(self):
    self.Close()

  def SetApp(self, app):
    self._app = app

  @property
  def app(self):
    return self._app

  @property
  def app_type(self):
    return self._app_type

  @property
  def platform_backend(self):
    return self._platform_backend

  def Foreground(self):
    # TODO(catapult:#2194): Remove the unnecessary pass below when the method
    # has been implemented on all concrete subclasses.
    pass  # pylint: disable=unnecessary-pass
    raise NotImplementedError

  def Background(self):
    raise NotImplementedError

  def Close(self):
    raise NotImplementedError

  def IsAppRunning(self):
    raise NotImplementedError
