4 years, 5 months ago
(2016-07-20 03:27:46 UTC)
#2
Patchset #1 (id:1) has been deleted
mcasas
Patchset #1 (id:20001) has been deleted
4 years, 5 months ago
(2016-07-20 16:19:16 UTC)
#3
Patchset #1 (id:20001) has been deleted
mcasas
Description was changed from ========== ImageCapture: replace Mojo String/Array with stl/wtf string/vector This CL nukes ...
4 years, 5 months ago
(2016-07-20 17:37:14 UTC)
#4
Description was changed from
==========
ImageCapture: replace Mojo String/Array with stl/wtf string/vector
This CL nukes the usage of mojo::String and mojo::Array<> after [1].
[1]
https://groups.google.com/a/chromium.org/forum/?utm_medium=email&utm_source=f...
BUG=624136, 518807
==========
to
==========
ImageCapture: replace Mojo String/Array with stl/wtf string/vector
This CL nukes the usage of mojo::String and mojo::Array<> after [1],
so where it was mojo::String it now reads std::string or WTF::String
and also mojo::Array<> is replaced with std::vector or WTF::Vector,
as appropriate.
[1]
https://groups.google.com/a/chromium.org/forum/?utm_medium=email&utm_source=f...
BUG=624136, 518807
==========
4 years, 5 months ago
(2016-07-20 22:57:02 UTC)
#12
https://codereview.chromium.org/2166713002/diff/40001/content/browser/media/c...
File content/browser/media/capture/image_capture_impl.cc (right):
https://codereview.chromium.org/2166713002/diff/40001/content/browser/media/c...
content/browser/media/capture/image_capture_impl.cc:57: base::Bind(callback,
mime_type, data));
On 2016/07/20 18:52:07, Wez wrote:
> |data| was previously move()'d, which was presumably just a pointer-swap, but
> must now be copied - can we arrange to keep the move semantics?
It's complicated due to the automatic generation
of the TakePhotoCallback, that includes const& for
|data|, but not impossible, so, done.
An alternative is to have a temporary
std::vector<uint8_t> data_copy = std::move(data);
but even then, due to |data| being const&, the
copy constructor would be used instead of the
move constructor, so one way or another,
const_cast is the only way I saw.
https://codereview.chromium.org/2166713002/diff/40001/media/capture/video/fak...
File media/capture/video/fake_video_capture_device.cc (right):
https://codereview.chromium.org/2166713002/diff/40001/media/capture/video/fak...
media/capture/video/fake_video_capture_device.cc:111:
callback.Run(std::string("image/png"), encoded_data);
On 2016/07/20 18:52:07, Wez wrote:
> nit: Do you need the explicit std::string here?
Nope, removed.
It wouldn't hurt performance because a temporary
constructed like this would not be re-wrapped into
another std:string, correct? So, removed for the sake
of less verbosity.
4 years, 5 months ago
(2016-07-20 23:05:13 UTC)
#13
https://codereview.chromium.org/2166713002/diff/40001/content/browser/media/c...
File content/browser/media/capture/image_capture_impl.cc (right):
https://codereview.chromium.org/2166713002/diff/40001/content/browser/media/c...
content/browser/media/capture/image_capture_impl.cc:57: base::Bind(callback,
mime_type, data));
On 2016/07/20 22:57:01, mcasas wrote:
> On 2016/07/20 18:52:07, Wez wrote:
> > |data| was previously move()'d, which was presumably just a pointer-swap,
but
> > must now be copied - can we arrange to keep the move semantics?
>
> It's complicated due to the automatic generation
> of the TakePhotoCallback, that includes const& for
> |data|, but not impossible, so, done.
>
> An alternative is to have a temporary
> std::vector<uint8_t> data_copy = std::move(data);
> but even then, due to |data| being const&, the
> copy constructor would be used instead of the
> move constructor, so one way or another,
> const_cast is the only way I saw.
I don't know whether it is necessary, but if you want here is one way to do it:
(1) define a mojom struct
// in mojom:
struct SomeData {
array<uint8> data;
};
(2) create a custom typemapping between SomeData and
std::unique_ptr<std::vector<uint8_t>>, in the typemap config annotate that this
type is move-only:
type_mappings = [ "SomeData=std::unique_ptr<std::vector<uint8_t>>[move_only]" ]
Wez
Basically I defer to Yuzhu's Mojo expertise! https://codereview.chromium.org/2166713002/diff/40001/content/browser/media/capture/image_capture_impl.cc File content/browser/media/capture/image_capture_impl.cc (right): https://codereview.chromium.org/2166713002/diff/40001/content/browser/media/capture/image_capture_impl.cc#newcode57 content/browser/media/capture/image_capture_impl.cc:57: base::Bind(callback, mime_type, ...
4 years, 5 months ago
(2016-07-20 23:19:55 UTC)
#14
4 years, 5 months ago
(2016-07-20 23:27:36 UTC)
#15
https://codereview.chromium.org/2166713002/diff/40001/content/browser/media/c...
File content/browser/media/capture/image_capture_impl.cc (right):
https://codereview.chromium.org/2166713002/diff/40001/content/browser/media/c...
content/browser/media/capture/image_capture_impl.cc:57: base::Bind(callback,
mime_type, data));
On 2016/07/20 23:19:54, Wez wrote:
> I mentioned this because |data| seems like it's some sort of bulky image data,
> and the old mojo::Array form was move-only, with [potentially] no copying
> end-to-end - I'd be wary of introducing an extra copy for any form of "bulk"
> data.
Agreed. Copy seems sad here. mcasas@ mentioned that he could use the const_cast
as a temp solution and add a TODO to address using typemapping separately. I am
personally fine with that.
mcasas
Done adding a TODO()
4 years, 5 months ago
(2016-07-20 23:46:06 UTC)
#16
Done adding a TODO()
Wez
LGTM (is there a looks-horrible-to-me-but-OK-I-suppose?) https://codereview.chromium.org/2166713002/diff/70001/content/browser/media/capture/image_capture_impl.cc File content/browser/media/capture/image_capture_impl.cc (right): https://codereview.chromium.org/2166713002/diff/70001/content/browser/media/capture/image_capture_impl.cc#newcode61 content/browser/media/capture/image_capture_impl.cc:61: base::Passed(const_cast<std::vector<uint8_t>*>(&data)))); nit: I take ...
4 years, 5 months ago
(2016-07-21 00:10:46 UTC)
#17
Description was changed from ========== ImageCapture: replace Mojo String/Array with stl/wtf string/vector This CL nukes ...
4 years, 5 months ago
(2016-07-21 00:25:38 UTC)
#18
Description was changed from
==========
ImageCapture: replace Mojo String/Array with stl/wtf string/vector
This CL nukes the usage of mojo::String and mojo::Array<> after [1],
so where it was mojo::String it now reads std::string or WTF::String
and also mojo::Array<> is replaced with std::vector or WTF::Vector,
as appropriate.
[1]
https://groups.google.com/a/chromium.org/forum/?utm_medium=email&utm_source=f...
BUG=624136, 518807
==========
to
==========
ImageCapture: replace Mojo String/Array with stl/wtf string/vector
This CL nukes the usage of mojo::String and mojo::Array<> after [1],
so where it was mojo::String it now reads std::string or WTF::String
and also mojo::Array<> is replaced with std::vector or WTF::Vector,
as appropriate.
[1]
https://groups.google.com/a/chromium.org/forum/?utm_medium=email&utm_source=f...
BUG=624136, 518807
TBR=xhwang@chromium.org
for the trivial change in media/mojo/interfaces/BUILD.gn
==========
mcasas
The CQ bit was checked by mcasas@chromium.org
4 years, 5 months ago
(2016-07-21 00:25:44 UTC)
#19
https://codereview.chromium.org/2166713002/diff/70001/content/browser/media/capture/image_capture_impl.cc File content/browser/media/capture/image_capture_impl.cc (right): https://codereview.chromium.org/2166713002/diff/70001/content/browser/media/capture/image_capture_impl.cc#newcode61 content/browser/media/capture/image_capture_impl.cc:61: base::Passed(const_cast<std::vector<uint8_t>*>(&data)))); On 2016/07/21 00:10:46, Wez wrote: > nit: I ...
4 years, 5 months ago
(2016-07-21 00:25:58 UTC)
#21
https://codereview.chromium.org/2166713002/diff/70001/content/browser/media/c...
File content/browser/media/capture/image_capture_impl.cc (right):
https://codereview.chromium.org/2166713002/diff/70001/content/browser/media/c...
content/browser/media/capture/image_capture_impl.cc:61:
base::Passed(const_cast<std::vector<uint8_t>*>(&data))));
On 2016/07/21 00:10:46, Wez wrote:
> nit: I take it it's not possible to have this work with std::move in some way?
It's too complicated. TBH let's commit this first,
knowing that I'll be working imminently on its
sequel (fret not, you'll review it) and that all
ImageCapture related code is behind a flag
(and the bug for introducing TypeMapping is
blocking the larger ImageCapture one).
You could siphon off the memory inside |data|
into a newly allocated std::unique_ptr<> that
is then base::Passed(std::move()) into the
base::Callback, but, again, not worth it.
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2166713002/70001
4 years, 5 months ago
(2016-07-21 00:26:20 UTC)
#22
Try jobs failed on following builders: linux_chromium_chromeos_ozone_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_chromeos_ozone_rel_ng/builds/204813)
4 years, 5 months ago
(2016-07-21 00:49:21 UTC)
#24
Try jobs failed on following builders: win8_chromium_gyp_rel on master.tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win8_chromium_gyp_rel/builds/2961)
4 years, 5 months ago
(2016-07-21 01:10:02 UTC)
#28
Dry run: Try jobs failed on following builders: linux_android_rel_ng on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/linux_android_rel_ng/builds/107749)
4 years, 5 months ago
(2016-07-21 02:03:27 UTC)
#32
Try jobs failed on following builders: linux_chromium_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/266381)
4 years, 5 months ago
(2016-07-21 04:14:42 UTC)
#37
Description was changed from ========== ImageCapture: replace Mojo String/Array with stl/wtf string/vector This CL nukes ...
4 years, 5 months ago
(2016-07-21 06:01:15 UTC)
#40
Message was sent while issue was closed.
Description was changed from
==========
ImageCapture: replace Mojo String/Array with stl/wtf string/vector
This CL nukes the usage of mojo::String and mojo::Array<> after [1],
so where it was mojo::String it now reads std::string or WTF::String
and also mojo::Array<> is replaced with std::vector or WTF::Vector,
as appropriate.
[1]
https://groups.google.com/a/chromium.org/forum/?utm_medium=email&utm_source=f...
BUG=624136, 518807
TBR=xhwang@chromium.org
for the trivial change in media/mojo/interfaces/BUILD.gn
==========
to
==========
ImageCapture: replace Mojo String/Array with stl/wtf string/vector
This CL nukes the usage of mojo::String and mojo::Array<> after [1],
so where it was mojo::String it now reads std::string or WTF::String
and also mojo::Array<> is replaced with std::vector or WTF::Vector,
as appropriate.
[1]
https://groups.google.com/a/chromium.org/forum/?utm_medium=email&utm_source=f...
BUG=624136, 518807
TBR=xhwang@chromium.org
for the trivial change in media/mojo/interfaces/BUILD.gn
==========
commit-bot: I haz the power
Committed patchset #4 (id:90001)
4 years, 5 months ago
(2016-07-21 06:01:17 UTC)
#41
Message was sent while issue was closed.
Committed patchset #4 (id:90001)
commit-bot: I haz the power
Description was changed from ========== ImageCapture: replace Mojo String/Array with stl/wtf string/vector This CL nukes ...
4 years, 5 months ago
(2016-07-21 06:03:06 UTC)
#42
Message was sent while issue was closed.
Description was changed from
==========
ImageCapture: replace Mojo String/Array with stl/wtf string/vector
This CL nukes the usage of mojo::String and mojo::Array<> after [1],
so where it was mojo::String it now reads std::string or WTF::String
and also mojo::Array<> is replaced with std::vector or WTF::Vector,
as appropriate.
[1]
https://groups.google.com/a/chromium.org/forum/?utm_medium=email&utm_source=f...
BUG=624136, 518807
TBR=xhwang@chromium.org
for the trivial change in media/mojo/interfaces/BUILD.gn
==========
to
==========
ImageCapture: replace Mojo String/Array with stl/wtf string/vector
This CL nukes the usage of mojo::String and mojo::Array<> after [1],
so where it was mojo::String it now reads std::string or WTF::String
and also mojo::Array<> is replaced with std::vector or WTF::Vector,
as appropriate.
[1]
https://groups.google.com/a/chromium.org/forum/?utm_medium=email&utm_source=f...
BUG=624136, 518807
TBR=xhwang@chromium.org
for the trivial change in media/mojo/interfaces/BUILD.gn
Committed: https://crrev.com/53d04735fed4c229ba5757ed38f4150dd4c15d7f
Cr-Commit-Position: refs/heads/master@{#406776}
==========
commit-bot: I haz the power
Patchset 4 (id:??) landed as https://crrev.com/53d04735fed4c229ba5757ed38f4150dd4c15d7f Cr-Commit-Position: refs/heads/master@{#406776}
4 years, 5 months ago
(2016-07-21 06:03:08 UTC)
#43
Issue 2166713002: ImageCapture: replace Mojo String/Array with stl/wtf string/vector
(Closed)
Created 4 years, 5 months ago by mcasas
Modified 4 years, 5 months ago
Reviewers: yzshen1, Wez, esprehn
Base URL: https://chromium.googlesource.com/chromium/src.git@master
Comments: 9