[TSF] Rename CurrentContent of nsTextStore to LockedContent

RESOLVED FIXED in mozilla34

Status

()

defect
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: masayuki, Assigned: masayuki)

Tracking

({inputmethod})

Trunk
mozilla34
x86_64
Windows 8.1
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

Currently, while the document is locked, nsTextStore caches the content and selection to CurrentContent and CurrentSelection.  But these information are available only while the document is locked.

However, for implement ITfMouseTrackerACP, nsTextStore needs to retrieve content information at installing ITfMouseSink (i.e., when ITfMouseTrackerACP::AdviseSink() is called).

I think that CurrentContent and CurrentSelection should be renamed to Locked*. And we need to make create GetCurrentContent() and GetCurrentSelection() for retrieving them anytime.
Er, sorry. CurrentSelection() is also available without the document lock. So, we can keep its name.
Summary: [TSF] Rename CurrentContent and CurrentSelection of nsTextStore to LockedContent and LockedSelection → [TSF] Rename CurrentContent of nsTextStore to LockedContent
Storing all text of focused editor may be bad for footprint. Therefore, we still need to release it at unlocking the document because TIP accesses only during document lock.

So, "locked content" is better name than "(current) content".

This will help when we need to access "current" content without document lock. E.g., at installing a sink.
Attachment #8477320 - Flags: review?(VYV03354)
Comment on attachment 8477320 [details] [diff] [review]
part.1 Rename nsTextStore::mContent and nsTextStore::CurrentContent() to mLockedContent and LockedContent()

>--- a/widget/windows/nsTextStore.h
>+++ b/widget/windows/nsTextStore.h
>@@ -245,18 +245,23 @@ protected:
>   bool     IsReadLock(DWORD aLock) const
>   {
>     return (TS_LF_READ == (aLock & TS_LF_READ));
>   }
>   bool     IsReadWriteLock(DWORD aLock) const
>   {
>     return (TS_LF_READWRITE == (aLock & TS_LF_READWRITE));
>   }
>+  bool     IsReadOrWriteLock(DWORD aLock) const
>+  {
>+    return !!(aLock & TS_LF_READ);
>+  }

What's the difference between IsReadLock and IsReadOrWriteLock?
(In reply to Masatoshi Kimura [:emk] from comment #4)
> Comment on attachment 8477320 [details] [diff] [review]
> part.1 Rename nsTextStore::mContent and nsTextStore::CurrentContent() to
> mLockedContent and LockedContent()
> 
> >--- a/widget/windows/nsTextStore.h
> >+++ b/widget/windows/nsTextStore.h
> >@@ -245,18 +245,23 @@ protected:
> >   bool     IsReadLock(DWORD aLock) const
> >   {
> >     return (TS_LF_READ == (aLock & TS_LF_READ));
> >   }
> >   bool     IsReadWriteLock(DWORD aLock) const
> >   {
> >     return (TS_LF_READWRITE == (aLock & TS_LF_READWRITE));
> >   }
> >+  bool     IsReadOrWriteLock(DWORD aLock) const
> >+  {
> >+    return !!(aLock & TS_LF_READ);
> >+  }
> 
> What's the difference between IsReadLock and IsReadOrWriteLock?

Oops, I misunderstood IsReadLock() as IsReadOnlyLock(). I'll remove IsReadOrWriteLock() and use IsReadLock().
Comment on attachment 8477320 [details] [diff] [review]
part.1 Rename nsTextStore::mContent and nsTextStore::CurrentContent() to mLockedContent and LockedContent()

(In reply to Masayuki Nakano (:masayuki) (Mozilla Japan) from comment #5)
> Oops, I misunderstood IsReadLock() as IsReadOnlyLock(). I'll remove
> IsReadOrWriteLock() and use IsReadLock().

OK, r=me with the extra method removed.
Attachment #8477320 - Flags: review?(VYV03354) → review+
Attachment #8477322 - Flags: review?(VYV03354) → review+
https://hg.mozilla.org/mozilla-central/rev/a180dbeebe4f
https://hg.mozilla.org/mozilla-central/rev/8a7771c44e38
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla34
You need to log in before you can comment on or make changes to this bug.