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

Unified Diff: tools/telemetry/telemetry/core/video.py

Issue 379443002: Change ownership of video file (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adressing comments Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: tools/telemetry/telemetry/core/video.py
diff --git a/tools/telemetry/telemetry/core/video.py b/tools/telemetry/telemetry/core/video.py
index f470437513b1f99d3a5cb6d3f576651f7f453c7b..a1ef3598089c19b71ded639ab15f4bcffce52dcb 100644
--- a/tools/telemetry/telemetry/core/video.py
+++ b/tools/telemetry/telemetry/core/video.py
@@ -3,6 +3,7 @@
# found in the LICENSE file.
import subprocess
+import tempfile
from telemetry.core import bitmap
from telemetry.core import platform
@@ -17,9 +18,9 @@ class BoundingBoxNotFoundException(Exception):
class Video(object):
"""Utilities for storing and interacting with the video capture."""
- def __init__(self, video_file_path):
- # TODO(satyanarayana): Figure out when to delete this file.
- self._video_file_path = video_file_path
+ def __init__(self, video_file_obj):
+ assert isinstance(video_file_obj, tempfile.NamedTemporaryFile)
nednguyen 2014/07/08 23:24:20 You may also want to assert that video_file_obj.cl
Satyanarayana N H Manyam 2014/07/09 00:58:02 class name here (tempfile._TemporaryFileWrapper) i
Satyanarayana N H Manyam 2014/07/09 00:58:02 Done.
+ self._video_file_obj = video_file_obj
self._tab_contents_bounding_box = None
def UploadToCloudStorage(self, bucket, target_path):
@@ -28,7 +29,7 @@ class Video(object):
Args:
target_path: Path indicating where to store the file in cloud storage.
"""
- cloud_storage.Insert(bucket, target_path, self._video_file_path)
+ cloud_storage.Insert(bucket, target_path, self._video_file_obj.name)
def GetVideoFrameIter(self):
"""Returns the iteration for processing the video capture.
@@ -42,7 +43,7 @@ class Video(object):
time_ms is milliseconds since navigationStart.
bitmap is a telemetry.core.Bitmap.
"""
- frame_generator = self._FramesFromMp4(self._video_file_path)
+ frame_generator = self._FramesFromMp4(self._video_file_obj.name)
# Flip through frames until we find the initial tab contents flash.
content_box = None

Powered by Google App Engine
This is Rietveld 408576698