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

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: Sync to head 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
« no previous file with comments | « tools/telemetry/telemetry/core/tab_unittest.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..0ec79744f84c69f3b78e688d1467220e7dcbcf37 100644
--- a/tools/telemetry/telemetry/core/video.py
+++ b/tools/telemetry/telemetry/core/video.py
@@ -17,9 +17,10 @@ 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 video_file_obj.delete
+ assert not video_file_obj.close_called
+ 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
« no previous file with comments | « tools/telemetry/telemetry/core/tab_unittest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698