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

Issue 545983005: CdmFileIOImpl: Refactor Write() implementation. (Closed)

Created:
6 years, 3 months ago by xhwang
Modified:
6 years, 3 months ago
CC:
chromium-reviews, feature-media-reviews_chromium.org, yusukes+watch_chromium.org, tzik, binji+watch_chromium.org, raymes+watch_chromium.org, eme-reviews_chromium.org, teravest+watch_chromium.org, nfullagar1, piman+watch_chromium.org, noelallen1, ihf+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

CdmFileIOImpl: Refactor Write() implementation. Previously we do a two step write: SetLength() followed by Write(). However, if CdmFileIOImpl is destroyed after SetLength() but before Write(), the file will be corrupted (having the new length but the old data). This CL refactor the write operation to: WriteToTempFile() followed by Rename(). This way, if CdmFileIOImpl is destroyed after WriteToTempFile() but before Rename(), the original file will not be touched. Other refactions done in this CL: - Add STATE_ERROR state. - Move OpenFile() from Open() to Read() and renamed it to OpenFileForRead(). - Update/Add test cases to cover new changes. BUG=410630 TEST=Updated unittests. Committed: https://crrev.com/5b083339c79a386488d4ce979ed4983c5f7dea0b Cr-Commit-Position: refs/heads/master@{#295430}

Patch Set 1 #

Total comments: 7

Patch Set 2 : Cannot use "ERROR" on Windows!!! Also polished tests. #

Total comments: 33

Patch Set 3 : comments addressed #

Total comments: 8

Patch Set 4 : comments addressed #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+347 lines, -120 lines) Patch
M media/cdm/ppapi/cdm_file_io_impl.h View 1 2 6 chunks +56 lines, -20 lines 0 comments Download
M media/cdm/ppapi/cdm_file_io_impl.cc View 1 2 3 12 chunks +163 lines, -86 lines 0 comments Download
M media/cdm/ppapi/cdm_file_io_test.h View 1 chunk +0 lines, -1 line 0 comments Download
M media/cdm/ppapi/cdm_file_io_test.cc View 1 2 3 14 chunks +128 lines, -13 lines 1 comment Download

Messages

Total messages: 21 (3 generated)
xhwang
ddorwin: Please review everything. tzik: I never used the Rename() API before. Please help check ...
6 years, 3 months ago (2014-09-15 23:56:15 UTC) #2
ddorwin
https://codereview.chromium.org/545983005/diff/1/media/cdm/ppapi/cdm_file_io_impl.cc File media/cdm/ppapi/cdm_file_io_impl.cc (right): https://codereview.chromium.org/545983005/diff/1/media/cdm/ppapi/cdm_file_io_impl.cc#newcode500 media/cdm/ppapi/cdm_file_io_impl.cc:500: file_io_.detach(); On 2014/09/15 23:56:15, xhwang wrote: > Is this ...
6 years, 3 months ago (2014-09-16 18:07:37 UTC) #3
xhwang
+dmichael: Please see the question inline about how to release a pepper resource. Thanks! https://codereview.chromium.org/545983005/diff/1/media/cdm/ppapi/cdm_file_io_impl.cc ...
6 years, 3 months ago (2014-09-16 19:56:21 UTC) #5
xhwang
On 2014/09/16 19:56:21, xhwang wrote: > +dmichael: Please see the question inline about how to ...
6 years, 3 months ago (2014-09-16 19:57:35 UTC) #6
dmichael (off chromium)
https://codereview.chromium.org/545983005/diff/1/media/cdm/ppapi/cdm_file_io_impl.cc File media/cdm/ppapi/cdm_file_io_impl.cc (right): https://codereview.chromium.org/545983005/diff/1/media/cdm/ppapi/cdm_file_io_impl.cc#newcode500 media/cdm/ppapi/cdm_file_io_impl.cc:500: file_io_.detach(); On 2014/09/16 19:56:21, xhwang wrote: > On 2014/09/16 ...
6 years, 3 months ago (2014-09-16 20:46:46 UTC) #7
tzik
Write() -> Rename() looks good to me. Don't multiple CdmFileIOs try to write single file ...
6 years, 3 months ago (2014-09-17 04:41:37 UTC) #8
xhwang
comments addressed
6 years, 3 months ago (2014-09-17 20:58:56 UTC) #9
xhwang
On 2014/09/17 04:41:37, tzik wrote: > Write() -> Rename() looks good to me. > Don't ...
6 years, 3 months ago (2014-09-17 21:01:00 UTC) #10
xhwang
I think I addressed all comments. PTAL again. Meanwhile, I'll do more stress test... https://codereview.chromium.org/545983005/diff/1/media/cdm/ppapi/cdm_file_io_impl.cc ...
6 years, 3 months ago (2014-09-17 21:02:32 UTC) #11
ddorwin
lgtm % comments. Thanks! https://codereview.chromium.org/545983005/diff/20001/media/cdm/ppapi/cdm_file_io_impl.cc File media/cdm/ppapi/cdm_file_io_impl.cc (right): https://codereview.chromium.org/545983005/diff/20001/media/cdm/ppapi/cdm_file_io_impl.cc#newcode311 media/cdm/ppapi/cdm_file_io_impl.cc:311: // finished On 2014/09/17 21:02:31, ...
6 years, 3 months ago (2014-09-17 23:16:38 UTC) #12
tzik
lgtm
6 years, 3 months ago (2014-09-18 03:29:36 UTC) #13
xhwang
comments addressed
6 years, 3 months ago (2014-09-18 05:56:55 UTC) #14
xhwang
https://codereview.chromium.org/545983005/diff/40001/media/cdm/ppapi/cdm_file_io_impl.cc File media/cdm/ppapi/cdm_file_io_impl.cc (right): https://codereview.chromium.org/545983005/diff/40001/media/cdm/ppapi/cdm_file_io_impl.cc#newcode98 media/cdm/ppapi/cdm_file_io_impl.cc:98: if (file_name_str.empty() || file_name_str[0] == '_' || On 2014/09/17 ...
6 years, 3 months ago (2014-09-18 05:58:08 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patchset/545983005/60001
6 years, 3 months ago (2014-09-18 05:59:20 UTC) #17
xhwang
On 2014/09/18 05:59:20, I haz the power (commit-bot) wrote: > CQ is trying da patch. ...
6 years, 3 months ago (2014-09-18 06:16:46 UTC) #18
commit-bot: I haz the power
Committed patchset #4 (id:60001) as c449680bcbd6eeb5041111c315478b1206d1a0e3
6 years, 3 months ago (2014-09-18 06:57:40 UTC) #19
commit-bot: I haz the power
Patchset 4 (id:??) landed as https://crrev.com/5b083339c79a386488d4ce979ed4983c5f7dea0b Cr-Commit-Position: refs/heads/master@{#295430}
6 years, 3 months ago (2014-09-18 06:58:57 UTC) #20
xhwang
6 years, 3 months ago (2014-09-18 15:58:18 UTC) #21
Message was sent while issue was closed.
On 2014/09/18 06:58:57, I haz the power (commit-bot) wrote:
> Patchset 4 (id:??) landed as
> https://crrev.com/5b083339c79a386488d4ce979ed4983c5f7dea0b
> Cr-Commit-Position: refs/heads/master@{#295430}

The CL is landed and bots look good so far. If the
ECKEncryptedMediaTest.FileIOTest test gets flaky, please please do not revert
the CL. Ping me please and I'll fix the test.

Powered by Google App Engine
This is Rietveld 408576698