mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-10 00:50:38 +01:00
Fix DCHECK during Find (issue #2050)
This commit is contained in:
parent
3d944a803e
commit
ca9abe98a9
@ -430,12 +430,15 @@ typedef struct _cef_browser_host_t {
|
|||||||
struct _cef_pdf_print_callback_t* callback);
|
struct _cef_pdf_print_callback_t* callback);
|
||||||
|
|
||||||
///
|
///
|
||||||
// Search for |searchText|. |identifier| can be used to have multiple searches
|
// Search for |searchText|. |identifier| must be a unique ID and these IDs
|
||||||
// running simultaniously. |forward| indicates whether to search forward or
|
// must strictly increase so that newer requests always have greater IDs than
|
||||||
// backward within the page. |matchCase| indicates whether the search should
|
// older requests. If |identifier| is zero or less than the previous ID value
|
||||||
// be case-sensitive. |findNext| indicates whether this is the first request
|
// then it will be automatically assigned a new valid ID. |forward| indicates
|
||||||
// or a follow-up. The cef_find_handler_t instance, if any, returned via
|
// whether to search forward or backward within the page. |matchCase|
|
||||||
// cef_client_t::GetFindHandler will be called to report find results.
|
// indicates whether the search should be case-sensitive. |findNext| indicates
|
||||||
|
// whether this is the first request or a follow-up. The cef_find_handler_t
|
||||||
|
// instance, if any, returned via cef_client_t::GetFindHandler will be called
|
||||||
|
// to report find results.
|
||||||
///
|
///
|
||||||
void (CEF_CALLBACK *find)(struct _cef_browser_host_t* self, int identifier,
|
void (CEF_CALLBACK *find)(struct _cef_browser_host_t* self, int identifier,
|
||||||
const cef_string_t* searchText, int forward, int matchCase,
|
const cef_string_t* searchText, int forward, int matchCase,
|
||||||
|
@ -472,12 +472,15 @@ class CefBrowserHost : public virtual CefBaseRefCounted {
|
|||||||
CefRefPtr<CefPdfPrintCallback> callback) =0;
|
CefRefPtr<CefPdfPrintCallback> callback) =0;
|
||||||
|
|
||||||
///
|
///
|
||||||
// Search for |searchText|. |identifier| can be used to have multiple searches
|
// Search for |searchText|. |identifier| must be a unique ID and these IDs
|
||||||
// running simultaniously. |forward| indicates whether to search forward or
|
// must strictly increase so that newer requests always have greater IDs than
|
||||||
// backward within the page. |matchCase| indicates whether the search should
|
// older requests. If |identifier| is zero or less than the previous ID value
|
||||||
// be case-sensitive. |findNext| indicates whether this is the first request
|
// then it will be automatically assigned a new valid ID. |forward| indicates
|
||||||
// or a follow-up. The CefFindHandler instance, if any, returned via
|
// whether to search forward or backward within the page. |matchCase|
|
||||||
// CefClient::GetFindHandler will be called to report find results.
|
// indicates whether the search should be case-sensitive. |findNext| indicates
|
||||||
|
// whether this is the first request or a follow-up. The CefFindHandler
|
||||||
|
// instance, if any, returned via CefClient::GetFindHandler will be called to
|
||||||
|
// report find results.
|
||||||
///
|
///
|
||||||
/*--cef()--*/
|
/*--cef()--*/
|
||||||
virtual void Find(int identifier, const CefString& searchText,
|
virtual void Find(int identifier, const CefString& searchText,
|
||||||
|
@ -784,6 +784,14 @@ void CefBrowserHostImpl::Find(int identifier, const CefString& searchText,
|
|||||||
if (!web_contents_)
|
if (!web_contents_)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Every find request must have a unique ID and these IDs must strictly
|
||||||
|
// increase so that newer requests always have greater IDs than older
|
||||||
|
// requests.
|
||||||
|
if (identifier <= find_request_id_counter_)
|
||||||
|
identifier = ++find_request_id_counter_;
|
||||||
|
else
|
||||||
|
find_request_id_counter_ = identifier;
|
||||||
|
|
||||||
blink::WebFindOptions options;
|
blink::WebFindOptions options;
|
||||||
options.forward = forward;
|
options.forward = forward;
|
||||||
options.match_case = matchCase;
|
options.match_case = matchCase;
|
||||||
|
@ -637,6 +637,9 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
|||||||
// Observers that want to be notified of changes to this object.
|
// Observers that want to be notified of changes to this object.
|
||||||
base::ObserverList<Observer> observers_;
|
base::ObserverList<Observer> observers_;
|
||||||
|
|
||||||
|
// Used to provide unique incremental IDs for each find request.
|
||||||
|
int find_request_id_counter_ = 0;
|
||||||
|
|
||||||
IMPLEMENT_REFCOUNTING(CefBrowserHostImpl);
|
IMPLEMENT_REFCOUNTING(CefBrowserHostImpl);
|
||||||
DISALLOW_COPY_AND_ASSIGN(CefBrowserHostImpl);
|
DISALLOW_COPY_AND_ASSIGN(CefBrowserHostImpl);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user