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

Issue 9264014: Upstream the clipboard implementation for Android (Closed)

Created:
8 years, 11 months ago by Peter Beverloo
Modified:
8 years, 4 months ago
CC:
chromium-reviews, brettw-cc_chromium.org, John Grabowski, acw, tony, Yaron
Visibility:
Public.

Description

Upstream the clipboard implementation for Android BUG= TEST=

Patch Set 1 #

Patch Set 2 : Minor cleanup #

Total comments: 15

Patch Set 3 : Another clean-up #

Total comments: 37

Patch Set 4 : Partially addressed comments #

Patch Set 5 : JNI comments #

Patch Set 6 : All comments addressed. #

Total comments: 6

Patch Set 7 : Addressed dcheng's comments #

Total comments: 6

Patch Set 8 : Addressed comments. #

Patch Set 9 : Address scoped JNI #

Patch Set 10 : Fix typo in Clipboard::ReadHTML #

Patch Set 11 : Fix typo in Clipboard::ReadHTML #

Patch Set 12 : content_unit_tests already being helpful #

Patch Set 13 : Change locks to use AutoLock (one exception) #

Total comments: 16

Patch Set 14 : Addressed comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+506 lines, -1 line) Patch
M ui/base/clipboard/clipboard.h View 1 2 3 4 5 6 7 8 4 chunks +38 lines, -1 line 0 comments Download
A ui/base/clipboard/clipboard_android.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +467 lines, -0 lines 0 comments Download
M ui/ui.gyp View 1 2 3 4 5 6 8 9 10 11 12 13 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 23 (0 generated)
Steve Block
lgtm for jni
8 years, 11 months ago (2012-01-19 17:35:17 UTC) #1
Peter Beverloo
+brettw for base/ OWNERS +sky for ui/base/ changes. Thank you, Steve! Brett and Scott, could ...
8 years, 11 months ago (2012-01-19 18:07:02 UTC) #2
dcheng
https://chromiumcodereview.appspot.com/9264014/diff/4001/ui/base/clipboard/clipboard.h File ui/base/clipboard/clipboard.h (right): https://chromiumcodereview.appspot.com/9264014/diff/4001/ui/base/clipboard/clipboard.h#newcode79 ui/base/clipboard/clipboard.h:79: int compare(const std::string& str) const { return data_.compare(str); } ...
8 years, 11 months ago (2012-01-19 18:10:17 UTC) #3
John Grabowski
https://chromiumcodereview.appspot.com/9264014/diff/4001/ui/base/clipboard/clipboard.h File ui/base/clipboard/clipboard.h (right): https://chromiumcodereview.appspot.com/9264014/diff/4001/ui/base/clipboard/clipboard.h#newcode79 ui/base/clipboard/clipboard.h:79: int compare(const std::string& str) const { return data_.compare(str); } ...
8 years, 11 months ago (2012-01-19 20:32:55 UTC) #4
sky
https://chromiumcodereview.appspot.com/9264014/diff/5006/ui/base/clipboard/clipboard.h File ui/base/clipboard/clipboard.h (right): https://chromiumcodereview.appspot.com/9264014/diff/5006/ui/base/clipboard/clipboard.h#newcode25 ui/base/clipboard/clipboard.h:25: #include <jni.h> include jni.h first, then newline, then lock.h ...
8 years, 11 months ago (2012-01-19 21:26:56 UTC) #5
Peter Beverloo
Thank you for the comments so far! Not everything has been addressed yet, I'll reply ...
8 years, 11 months ago (2012-01-20 15:13:51 UTC) #6
Peter Beverloo
Addressed the JNI comments. Still a few pending. https://chromiumcodereview.appspot.com/9264014/diff/5006/ui/base/clipboard/clipboard_android.cc File ui/base/clipboard/clipboard_android.cc (right): https://chromiumcodereview.appspot.com/9264014/diff/5006/ui/base/clipboard/clipboard_android.cc#newcode76 ui/base/clipboard/clipboard_android.cc:76: JNIEnv* ...
8 years, 11 months ago (2012-01-25 18:19:06 UTC) #7
Peter Beverloo
sky, could you take another look please? Cheers! https://chromiumcodereview.appspot.com/9264014/diff/5006/ui/base/clipboard/clipboard_android.cc File ui/base/clipboard/clipboard_android.cc (right): https://chromiumcodereview.appspot.com/9264014/diff/5006/ui/base/clipboard/clipboard_android.cc#newcode34 ui/base/clipboard/clipboard_android.cc:34: base::LazyInstance<base::Lock> ...
8 years, 10 months ago (2012-02-01 14:43:29 UTC) #8
dcheng
Just minor nits from me. http://codereview.chromium.org/9264014/diff/20001/ui/base/clipboard/clipboard.h File ui/base/clipboard/clipboard.h (right): http://codereview.chromium.org/9264014/diff/20001/ui/base/clipboard/clipboard.h#newcode26 ui/base/clipboard/clipboard.h:26: #include "base/synchronization/lock.h" I think ...
8 years, 10 months ago (2012-02-01 19:02:04 UTC) #9
Peter Beverloo
Thanks. https://chromiumcodereview.appspot.com/9264014/diff/20001/ui/base/clipboard/clipboard.h File ui/base/clipboard/clipboard.h (right): https://chromiumcodereview.appspot.com/9264014/diff/20001/ui/base/clipboard/clipboard.h#newcode26 ui/base/clipboard/clipboard.h:26: #include "base/synchronization/lock.h" On 2012/02/01 19:02:04, dcheng wrote: > ...
8 years, 10 months ago (2012-02-02 12:16:11 UTC) #10
sky
https://chromiumcodereview.appspot.com/9264014/diff/25002/ui/base/clipboard/clipboard.h File ui/base/clipboard/clipboard.h (right): https://chromiumcodereview.appspot.com/9264014/diff/25002/ui/base/clipboard/clipboard.h#newcode73 ui/base/clipboard/clipboard.h:73: #elif defined(USE_AURA) || defined(OS_ANDROID) Remove defined(OS_ANDROID) here, and instead ...
8 years, 10 months ago (2012-02-03 17:14:35 UTC) #11
Peter Beverloo
Cheers. https://chromiumcodereview.appspot.com/9264014/diff/25002/ui/base/clipboard/clipboard.h File ui/base/clipboard/clipboard.h (right): https://chromiumcodereview.appspot.com/9264014/diff/25002/ui/base/clipboard/clipboard.h#newcode73 ui/base/clipboard/clipboard.h:73: #elif defined(USE_AURA) || defined(OS_ANDROID) On 2012/02/03 17:14:35, sky ...
8 years, 10 months ago (2012-02-07 12:25:03 UTC) #12
sky
On Tue, Feb 7, 2012 at 4:25 AM, <peter@chromium.org> wrote: > Cheers. > > > ...
8 years, 10 months ago (2012-02-07 16:54:32 UTC) #13
Peter Beverloo
On 2012/02/07 16:54:32, sky wrote: > I'm going to hold off until this lands, otherwise ...
8 years, 10 months ago (2012-02-14 00:41:09 UTC) #14
dcheng
On 2012/02/14 00:41:09, Peter Beverloo wrote: > On 2012/02/07 16:54:32, sky wrote: > > I'm ...
8 years, 10 months ago (2012-02-14 00:52:27 UTC) #15
John Grabowski
Hmm. I would have leant in the other direction and switched the UI thread to ...
8 years, 10 months ago (2012-02-14 01:33:41 UTC) #16
dcheng
On 2012/02/14 01:33:41, John Grabowski wrote: > Hmm. I would have leant in the other ...
8 years, 10 months ago (2012-02-14 01:38:15 UTC) #17
John Grabowski
> > > It might be OK to only do this for certain platforms (e.g. ...
8 years, 10 months ago (2012-02-14 01:40:07 UTC) #18
sky
On Mon, Feb 13, 2012 at 4:41 PM, <peter@chromium.org> wrote: > On 2012/02/07 16:54:32, sky ...
8 years, 10 months ago (2012-02-14 04:31:43 UTC) #19
Peter Beverloo
On 2012/02/14 04:31:43, sky wrote: > If we need to do reading on a different ...
8 years, 10 months ago (2012-02-15 18:25:28 UTC) #20
sky
https://chromiumcodereview.appspot.com/9264014/diff/38003/ui/base/clipboard/clipboard.h File ui/base/clipboard/clipboard.h (right): https://chromiumcodereview.appspot.com/9264014/diff/38003/ui/base/clipboard/clipboard.h#newcode87 ui/base/clipboard/clipboard.h:87: const std::string& ToString() const { return data_; } This ...
8 years, 10 months ago (2012-02-16 17:06:43 UTC) #21
Peter Beverloo
Thank you for the review! https://chromiumcodereview.appspot.com/9264014/diff/38003/ui/base/clipboard/clipboard.h File ui/base/clipboard/clipboard.h (right): https://chromiumcodereview.appspot.com/9264014/diff/38003/ui/base/clipboard/clipboard.h#newcode87 ui/base/clipboard/clipboard.h:87: const std::string& ToString() const ...
8 years, 10 months ago (2012-02-16 20:38:39 UTC) #22
sky
8 years, 10 months ago (2012-02-16 20:46:50 UTC) #23
https://chromiumcodereview.appspot.com/9264014/diff/38003/ui/base/clipboard/c...
File ui/base/clipboard/clipboard.h (right):

https://chromiumcodereview.appspot.com/9264014/diff/38003/ui/base/clipboard/c...
ui/base/clipboard/clipboard.h:87: const std::string& ToString() const { return
data_; }
On 2012/02/16 20:38:40, Peter Beverloo wrote:
> On 2012/02/16 17:06:44, sky wrote:
> > This should be data()
> 
> data_ actually contains the name of the format type, not the actual data
itself
> (see uses of the FormatType constructor), so that would be wrong, wouldn't it?

The style guide says if you're returning a field, the name should match the
field name in unix_hacker_style.

https://chromiumcodereview.appspot.com/9264014/diff/38003/ui/base/clipboard/c...
File ui/base/clipboard/clipboard_android.cc (right):

https://chromiumcodereview.appspot.com/9264014/diff/38003/ui/base/clipboard/c...
ui/base/clipboard/clipboard_android.cc:430: if (IsTextAvailableFromAndroid()) {
On 2012/02/16 20:38:40, Peter Beverloo wrote:
> On 2012/02/16 17:06:44, sky wrote:
> > What happens if g_clipboard_map gets mutated after this?
> 
> You're right, thanks, that could result in the internal_text being freed up.
> An issue here is that ClearInternalClipboard() creates a new lock, while we'd
> ideally be in a lock already to avoid the race.
> I could call g_clipboard_map->clear() on line 442 and 447 instead and placing
an
> AutoLock on the whole method, but that'd be sensitive to being overseen if
CIC()
> ever changes (even though g_clipboard_map is already being used directly in
> several other places). Alternatively we could add
ClearInternalClipboardNoLock.
> Do you have a preference here?

This is why I preferred simplifying the threading. If the other thread only
needs to read, can't it be passed a copy so we don't need to worry about
locking?

Powered by Google App Engine
This is Rietveld 408576698