Commit b2dcf381 authored by Hodol Han's avatar Hodol Han Committed by Commit Bot

ui/base/dragdrop: Remove owns_medium from StorageDataInfo

Currently there is only ui::DataObjectImpl::SetData which sets
|owns_medium|, but it should always be true because of DataObjectimpl
duplicates the medium if |should_release| is false.

Bug: 11078061
Test: Run ui_base_unittests.exe --gtest_filter="OSExchangeDataWinTest.SetData*"
Change-Id: I62125ef6d0c4d5d364deb2deefd8272a973507e9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2308637
Commit-Queue: Darwin Huang <huangdarwin@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarVictor Costan <pwnall@chromium.org>
Reviewed-by: default avatarDarwin Huang <huangdarwin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#793425}
parent f68e9af2
......@@ -842,13 +842,12 @@ static void DuplicateMedium(CLIPFORMAT source_clipformat,
DataObjectImpl::StoredDataInfo::StoredDataInfo(const FORMATETC& format_etc,
STGMEDIUM* medium)
: format_etc(format_etc), medium(medium), owns_medium(true) {}
: format_etc(format_etc), medium(medium) {}
DataObjectImpl::StoredDataInfo::~StoredDataInfo() {
if (owns_medium) {
ReleaseStgMedium(medium);
delete medium;
}
ReleaseStgMedium(medium);
delete medium;
if (downloader.get())
downloader->Stop();
}
......@@ -992,12 +991,6 @@ HRESULT DataObjectImpl::SetData(
local_medium);
info->medium->tymed = format_etc->tymed;
// Since the medium is copied if |should_release| is false, it should be
// released whether that flag is true or not.
// TODO(crbug.com/1107806): Remove owns_medium, because its value is always
// true.
info->owns_medium = true;
// Make newly added data appear first.
// TODO(dcheng): Make various setters agree whether elements should be
// prioritized from front to back or back to front.
......
......@@ -97,7 +97,6 @@ class DataObjectImpl : public DownloadFileObserver,
struct StoredDataInfo {
FORMATETC format_etc;
STGMEDIUM* medium;
bool owns_medium;
std::unique_ptr<DownloadFileProvider> downloader;
StoredDataInfo(const FORMATETC& format_etc, STGMEDIUM* medium);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment