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

Issue 2054373002: FileWrapper[Impl] modifications and actually remove the "Impl" class. (Closed)

Created:
4 years, 6 months ago by tommi
Modified:
4 years, 2 months ago
Reviewers:
åsapersson
CC:
webrtc-reviews_webrtc.org, yujie_mao (webrtc), qiang.lu, peah-webrtc, bjornv1, video-team_agora.io, tterriberry_mozilla.com, fengyue_agora.io, sdk-team_agora.io, minyue-webrtc, mflodman, Andrew MacDonald, zhengzhonghou_agora.io, stefan-webrtc, kwiberg-webrtc, interface-changes_webrtc.org, henrika_webrtc, audio-team_agora.io, hlundin-webrtc, niklas.enbom, the sun, pbos-webrtc, aluebs-webrtc
Base URL:
https://chromium.googlesource.com/external/webrtc.git@master
Target Ref:
refs/pending/heads/master
Project:
webrtc
Visibility:
Public.

Description

FileWrapper[Impl] modifications and actually remove the "Impl" class. This is a somewhat involved refactoring of this class. Here's an overview of the changes: * FileWrapper can now be used as a regular class and instances allocated on the stack. * The type now has support for move semantics and copy isn't allowed. * New public ctor with FILE* that can be used instead of OpenFromFileHandle. * New static Open() method. The intent of this is to allow opening a file and getting back a FileWrapper instance. Using this method instead of Create(), will allow us in the future to make the FILE* member pointer, to be const and simplify threading (get rid of the lock). * Rename the Open() method to is_open() and make it inline. * The FileWrapper interface is no longer a pure virtual interface. There's only one implementation so there's no need to go through a vtable for everything. * Functionality offered by the class, is now reduced. No support for looping (not clear if that was actually useful to users of that flag), no need to implement the 'read_only_' functionality in the class, since file APIs implement that already, no support for *not* managing the file handle (this wasn't used). OpenFromFileHandle always "manages" the file. * Delete the unused WriteText() method and don't support opening files in text mode. Text mode is only different on Windows and on Windows it translates \n to \r\n, which means that files such as log files, could have a slightly different format on Windows than other platforms. Besides, tools on Windows can handle UNIX line endings. * Remove FileName(), change Trace code to manage its own path. * Rename id_ member variable to file_. * Removed the open_ member variable since the same functionality can be gotten from just checking the file pointer. * Don't call CloseFile inside of Write. Write shouldn't be changing the state of the class beyond just attempting to write. * Remove concept of looping from FileWrapper and never close inside of Read() * Changed stream base classes to inherit from a common base class instead of both defining the Rewind method. Ultimately, Id' like to remove these interfaces and just have FileWrapper. * Remove read_only param from OpenFromFileHandle * Renamed size_in_bytes_ to position_, since it gets set to 0 when Rewind() is called (and the size actually does not change). * Switch out rw lock for CriticalSection. The r/w lock was only used for reading when checking the open_ flag. BUG= Committed: https://crrev.com/a6219cc3ef08dd9b2981b065b6f051d7de0866f8 Cr-Commit-Position: refs/heads/master@{#13155}

Patch Set 1 #

Patch Set 2 : Tag UpdateFileName as requiring |crit_| to be held #

Patch Set 3 : Simplify FileOpen #

Patch Set 4 : Remove file_impl.h #

Patch Set 5 : Rename Open() to is_open() and inline. #

Patch Set 6 : Fix compile error in func_test_manager.cc #

Total comments: 10

Patch Set 7 : Address comments #

Patch Set 8 : Fix use of ASSERT instead of ASSERT_TRUE in test #

Unified diffs Side-by-side diffs Delta from patch set Stats (+323 lines, -643 lines) Patch
M webrtc/call/rtc_event_log.cc View 1 2 3 4 5 6 3 chunks +3 lines, -3 lines 0 comments Download
M webrtc/call/rtc_event_log_helper_thread.cc View 1 2 3 4 11 chunks +15 lines, -15 lines 0 comments Download
M webrtc/common_types.h View 1 2 3 4 5 6 1 chunk +16 lines, -20 lines 0 comments Download
M webrtc/common_types.cc View 2 chunks +2 lines, -7 lines 0 comments Download
M webrtc/modules/audio_device/audio_device_buffer.cc View 1 2 3 4 5 6 4 chunks +8 lines, -10 lines 0 comments Download
M webrtc/modules/audio_device/dummy/file_audio_device.cc View 1 2 3 4 5 6 6 chunks +8 lines, -20 lines 0 comments Download
M webrtc/modules/audio_device/test/func_test_manager.cc View 1 2 3 4 5 6 2 chunks +27 lines, -37 lines 0 comments Download
M webrtc/modules/audio_processing/audio_processing_impl.cc View 1 2 3 4 5 6 13 chunks +15 lines, -30 lines 0 comments Download
M webrtc/modules/audio_processing/transient/click_annotate.cc View 1 2 3 4 1 chunk +4 lines, -4 lines 0 comments Download
M webrtc/modules/audio_processing/transient/file_utils.cc View 1 2 3 4 8 chunks +8 lines, -8 lines 0 comments Download
M webrtc/modules/audio_processing/transient/file_utils_unittest.cc View 1 2 3 4 5 6 12 chunks +36 lines, -72 lines 0 comments Download
M webrtc/modules/audio_processing/transient/transient_detector_unittest.cc View 1 2 3 4 2 chunks +3 lines, -7 lines 0 comments Download
M webrtc/modules/audio_processing/transient/wpd_tree_unittest.cc View 1 2 3 4 3 chunks +6 lines, -15 lines 0 comments Download
M webrtc/modules/media_file/media_file_impl.cc View 1 2 3 4 5 6 2 chunks +10 lines, -13 lines 0 comments Download
M webrtc/modules/media_file/media_file_utility.cc View 1 2 3 4 5 6 1 chunk +5 lines, -6 lines 0 comments Download
M webrtc/modules/video_coding/utility/ivf_file_writer.cc View 1 2 3 4 5 6 4 chunks +6 lines, -4 lines 0 comments Download
M webrtc/modules/video_coding/utility/ivf_file_writer_unittest.cc View 1 2 3 4 5 6 7 3 chunks +4 lines, -4 lines 0 comments Download
M webrtc/system_wrappers/BUILD.gn View 1 2 3 1 chunk +0 lines, -1 line 0 comments Download
M webrtc/system_wrappers/include/file_wrapper.h View 1 2 3 4 5 6 2 chunks +43 lines, -33 lines 0 comments Download
M webrtc/system_wrappers/include/trace.h View 1 chunk +0 lines, -3 lines 0 comments Download
M webrtc/system_wrappers/source/data_log.cc View 1 2 3 4 5 6 1 chunk +3 lines, -9 lines 0 comments Download
M webrtc/system_wrappers/source/file_impl.h View 1 2 3 1 chunk +0 lines, -70 lines 0 comments Download
M webrtc/system_wrappers/source/file_impl.cc View 1 2 3 4 5 6 2 chunks +81 lines, -206 lines 0 comments Download
M webrtc/system_wrappers/source/trace_impl.h View 1 3 chunks +3 lines, -5 lines 0 comments Download
M webrtc/system_wrappers/source/trace_impl.cc View 1 2 3 4 5 6 8 chunks +16 lines, -38 lines 0 comments Download
M webrtc/system_wrappers/system_wrappers.gyp View 1 2 3 1 chunk +0 lines, -1 line 0 comments Download
M webrtc/test/fake_audio_device.cc View 1 2 3 4 5 6 1 chunk +1 line, -2 lines 0 comments Download

Messages

Total messages: 30 (11 generated)
tommi
Tag UpdateFileName as requiring |crit_| to be held
4 years, 6 months ago (2016-06-12 16:44:16 UTC) #1
tommi
Simplify FileOpen
4 years, 6 months ago (2016-06-12 17:43:09 UTC) #2
tommi
Remove file_impl.h
4 years, 6 months ago (2016-06-12 18:10:28 UTC) #3
tommi
Rename Open() to is_open() and inline.
4 years, 6 months ago (2016-06-12 19:20:43 UTC) #4
tommi
Fix compile error in func_test_manager.cc
4 years, 6 months ago (2016-06-12 19:59:08 UTC) #6
tommi
4 years, 6 months ago (2016-06-13 20:19:51 UTC) #9
åsapersson
lgtm https://codereview.webrtc.org/2054373002/diff/100001/webrtc/common_types.h File webrtc/common_types.h (right): https://codereview.webrtc.org/2054373002/diff/100001/webrtc/common_types.h#newcode65 webrtc/common_types.h:65: // Reads |length| bytes from file to |buf|. ...
4 years, 6 months ago (2016-06-14 15:22:12 UTC) #10
tommi
Address comments
4 years, 6 months ago (2016-06-14 20:44:56 UTC) #11
tommi
https://codereview.webrtc.org/2054373002/diff/100001/webrtc/common_types.h File webrtc/common_types.h (right): https://codereview.webrtc.org/2054373002/diff/100001/webrtc/common_types.h#newcode65 webrtc/common_types.h:65: // Reads |length| bytes from file to |buf|. Returns ...
4 years, 6 months ago (2016-06-14 20:45:34 UTC) #12
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2054373002/120001
4 years, 6 months ago (2016-06-14 20:45:51 UTC) #14
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: win_x64_rel on tryserver.webrtc (JOB_FAILED, http://build.chromium.org/p/tryserver.webrtc/builders/win_x64_rel/builds/15478)
4 years, 6 months ago (2016-06-14 20:54:22 UTC) #16
tommi
Fix use of ASSERT instead of ASSERT_TRUE in test
4 years, 6 months ago (2016-06-15 16:32:45 UTC) #17
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2054373002/140001
4 years, 6 months ago (2016-06-15 16:33:12 UTC) #19
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 6 months ago (2016-06-15 17:05:20 UTC) #21
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2054373002/140001
4 years, 6 months ago (2016-06-15 17:28:29 UTC) #24
commit-bot: I haz the power
Committed patchset #8 (id:140001)
4 years, 6 months ago (2016-06-15 17:30:20 UTC) #26
commit-bot: I haz the power
CQ bit was unchecked
4 years, 6 months ago (2016-06-15 17:30:23 UTC) #27
commit-bot: I haz the power
Patchset 8 (id:??) landed as https://crrev.com/a6219cc3ef08dd9b2981b065b6f051d7de0866f8 Cr-Commit-Position: refs/heads/master@{#13155}
4 years, 6 months ago (2016-06-15 17:30:28 UTC) #29
nisse-webrtc
4 years, 2 months ago (2016-10-19 11:10:14 UTC) #30
Message was sent while issue was closed.
On 2016/06/15 17:30:28, commit-bot: I haz the power wrote:
> Patchset 8 (id:??) landed as
> https://crrev.com/a6219cc3ef08dd9b2981b065b6f051d7de0866f8
> Cr-Commit-Position: refs/heads/master@{#13155}

This change breaks building with rtc_enable_data_logging = true, errors like

../../webrtc/system_wrappers/source/data_log.cc:228:16: error: no member named
'WriteText' in 'webrtc::FileWrapper'
        file_->WriteText("%s[%u],", column_it->first.c_str(),
        ~~~~~  ^

I'm considering simply deleting all of the data_log stuff, used in only one
place, webrtc/modules/audio_coding/neteq/audio_decoder_unittest.cc; if no one's
noticed in four months that it's broken, it's unlikely to ever be used.

Powered by Google App Engine
This is Rietveld 408576698